Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
test: Update tests to address changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrew82 committed Jan 19, 2024
1 parent 7857af5 commit d5d69c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions nautobot_ssot_dna_center/tests/test_adapters_dna_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def setUp(self):
]
self.dna_center_client.find_latitude_and_longitude.return_value = ("", "")
self.dna_center_client.get_device_detail.return_value = DEVICE_DETAIL_FIXTURE
self.dna_center_client.get_model_name.return_value = "WS-C3850-24P-L"
self.dna_center_client.parse_site_hierarchy.return_value = {
"areas": ["Global", "NY"],
"building": "Building1",
Expand Down
3 changes: 2 additions & 1 deletion nautobot_ssot_dna_center/tests/test_models_nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ def setUp(self):
self.test_bldg.diffsync = MagicMock()
self.test_bldg.diffsync.job = MagicMock()
self.test_bldg.diffsync.job.log_info = MagicMock()
self.test_bldg.diffsync.job.log_warning = MagicMock()

def test_create_wo_parent(self):
"""Validate the NautobotBuilding create() method creates a Site without a matching parent Region."""
ids = {"name": "HQ"}
attrs = {"address": "123 Main St", "area": "NY", "latitude": "12.345", "longitude": "-67.890", "tenant": "G&A"}
result = NautobotBuilding.create(self.diffsync, ids, attrs)
self.assertIsInstance(result, NautobotBuilding)
self.diffsync.job.log_info.assert_called_with(message="Unable to find parent NY")
self.diffsync.job.log_warning.assert_called_with(message="Unable to find parent NY")
site_obj = Site.objects.get(name=ids["name"])
self.assertFalse(getattr(site_obj, "region"))
self.assertEqual(site_obj.physical_address, attrs["address"])
Expand Down
2 changes: 1 addition & 1 deletion nautobot_ssot_dna_center/tests/test_utils_dna_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_connect_success(self, mock_api):
def test_connect_error(self, mock_api):
self.dnac.conn = None
mock_api.side_effect = dnacentersdkException(self.mock_response)
with self.assertLogs(level="ERROR") as log:
with self.assertRaises(dnacentersdkException) as log:
self.dnac.connect()
self.assertIn("Unable to connect to DNA Center", log.output[0])
mock_api.assert_called_once_with( # nosec B106
Expand Down

0 comments on commit d5d69c9

Please sign in to comment.