diff --git a/tests/unit/test_nautobot_inventory.py b/tests/unit/test_nautobot_inventory.py index 2e8f6ff..5db341c 100644 --- a/tests/unit/test_nautobot_inventory.py +++ b/tests/unit/test_nautobot_inventory.py @@ -1,4 +1,5 @@ """Pytest of Nautobot Inventory.""" + # Standard Library Imports from os import path @@ -23,11 +24,26 @@ "url": "http://mock.example.com/api/", "method": "get", }, + { + "fixture_path": f"{HERE}/mocks/00_api_root.json", + "url": "https://mock.example.com/api/", + "method": "get", + }, { "fixture_path": f"{HERE}/mocks/01_get_devices.json", "url": "http://mock.example.com/api/dcim/devices/?depth=1", "method": "get", }, + { + "fixture_path": f"{HERE}/mocks/01_get_devices.json", + "url": "https://mock.example.com/api/dcim/devices/?depth=1", + "method": "get", + }, + { + "fixture_path": f"{HERE}/mocks/01_get_devices.json", + "url": "https://mock.example.com/api/dcim/devices/?depth=1&limit=0", + "method": "get", + }, { "fixture_path": f"{HERE}/mocks/02_get_device1.json", "url": "http://mock.example.com/api/dcim/devices/?name=den-dist01", @@ -89,6 +105,28 @@ def test_nornir_nautobot_initialization(): assert no_exception_found +def test_nornir_nautobot_initialization_ssl_verify_default(): + with Mocker() as mock: + load_api_calls(mock) + nornir_nautobot_class = NautobotInventory( + nautobot_url="https://mock.example.com", nautobot_token="0123456789abcdef01234567890" + ) + assert nornir_nautobot_class.pynautobot_obj.http_session.verify == True + assert nornir_nautobot_class.api_session.verify == True + assert nornir_nautobot_class.ssl_verify == True + + +def test_nornir_nautobot_initialization_ssl_verify_false(): + with Mocker() as mock: + load_api_calls(mock) + nornir_nautobot_class = NautobotInventory( + nautobot_url="https://mock.example.com", nautobot_token="0123456789abcdef01234567890", ssl_verify=False + ) + assert nornir_nautobot_class.pynautobot_obj.http_session.verify == False + assert nornir_nautobot_class.api_session.verify == False + assert nornir_nautobot_class.ssl_verify == False + + def test_nornir_nautobot_missing_url(): with pytest.raises(ValueError) as err: NautobotInventory(nautobot_url=None, nautobot_token="0123456789abcdef01234567890")