Skip to content

Commit

Permalink
test: ✅ Fix tests and pylint complaint
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrew82 committed Aug 13, 2024
1 parent 3280c8b commit f9cfc90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion nautobot_ssot/integrations/infoblox/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Meta:
fields = "__all__"


class SSOTInfobloxConfigFilterForm(NautobotFilterForm):
class SSOTInfobloxConfigFilterForm(NautobotFilterForm): # pylint: disable=too-many-ancestors
"""Filter form for SSOTInfobloxConfig filter searches."""

model = SSOTInfobloxConfig
Expand Down
20 changes: 10 additions & 10 deletions nautobot_ssot/tests/ipfabric/test_nbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def test_create_ip_alread_exists(self):
@unittest.mock.patch("logging.Logger", autospec=True)
def test_create_ip_fail_to_get_status_multiple_returned(self, mock_logger, mock_ipaddress, mock_status):
"""Test `create_device_type_object` Utility."""
mock_status().get.side_effect = [Status.MultipleObjectsReturned]
mock_status(model=IPAddress).get.side_effect = [Status.MultipleObjectsReturned]
logger = mock_logger("nb_job")
test_ip = create_ip("192.168.0.1", "255.255.255.255", logger=logger)
mock_ipaddress.assert_not_called()
Expand All @@ -391,7 +391,7 @@ def test_create_ip_fail_to_get_status_multiple_returned(self, mock_logger, mock_
@unittest.mock.patch("logging.Logger", autospec=True)
def test_create_ip_fail_to_get_status_does_not_exist(self, mock_logger, mock_ipaddress, mock_status):
"""Test `create_device_type_object` Utility."""
mock_status().get.side_effect = [Status.DoesNotExist]
mock_status(model=DeviceType).get.side_effect = [Status.DoesNotExist]
logger = mock_logger("nb_job")
test_ip = create_ip("192.168.0.1", "255.255.255.255", logger=logger)
mock_ipaddress.assert_not_called()
Expand Down Expand Up @@ -440,7 +440,7 @@ def test_create_ip_db_error_on_first_try(
mock_status,
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=IPAddress).get.return_value = "mock_status"
mock_prefix.return_value = ("mock_prefix", False)
mock_ip.side_effect = [DjangoBaseDBError, ("mock_ipaddress", True)]
logger = mock_logger("nb_job")
Expand Down Expand Up @@ -481,7 +481,7 @@ def test_create_ip_validation_error_on_first_try(
mock_status,
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=IPAddress).get.return_value = "mock_status"
mock_prefix.return_value = ("mock_prefix", False)
mock_ip.side_effect = [ValidationError("failure"), ("mock_ipaddress", True)]
logger = mock_logger("nb_job")
Expand Down Expand Up @@ -524,7 +524,7 @@ def test_create_ip_db_error_on_first_try_assign_ip(
mock_status,
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=DeviceType).get.return_value = "mock_status"
mock_prefix.return_value = ("mock_prefix", False)
mock_ip.side_effect = [DjangoBaseDBError, ("mock_ipaddress", True)]
logger = mock_logger("nb_job")
Expand Down Expand Up @@ -572,7 +572,7 @@ def test_create_ip_validation_error_on_first_try_assign_ip(
mock_status,
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=DeviceType).get.return_value = "mock_status"
mock_prefix.return_value = ("mock_prefix", False)
mock_ip.side_effect = [ValidationError("failure"), ("mock_ipaddress", True)]
logger = mock_logger("nb_job")
Expand Down Expand Up @@ -610,7 +610,7 @@ def test_create_ip_error_on_first_try_db_error_on_prefix(
self, mock_logger, mock_tag_object, mock_prefix, mock_ipaddress_to_interface, mock_ip, mock_status
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=DeviceType).get.return_value = "mock_status"
mock_prefix.side_effect = [DjangoBaseDBError]
mock_ip.side_effect = [ValidationError("failure")]
logger = mock_logger("nb_job")
Expand All @@ -637,7 +637,7 @@ def test_create_ip_error_on_first_try_validation_error_on_prefix(
self, mock_logger, mock_tag_object, mock_prefix, mock_ipaddress_to_interface, mock_ip, mock_status
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=DeviceType).get.return_value = "mock_status"
mock_prefix.side_effect = [ValidationError("failure")]
mock_ip.side_effect = [ValidationError("failure")]
logger = mock_logger("nb_job")
Expand All @@ -664,7 +664,7 @@ def test_create_ip_error_on_first_try_db_error_on_second_try(
self, mock_logger, mock_tag_object, mock_prefix, mock_ipaddress_to_interface, mock_ip, mock_status
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=DeviceType).get.return_value = "mock_status"
mock_prefix.return_value = ("mock_prefix", False)
mock_ip.side_effect = [ValidationError("failure"), DjangoBaseDBError]
logger = mock_logger("nb_job")
Expand Down Expand Up @@ -696,7 +696,7 @@ def test_create_ip_error_on_first_try_validation_error_on_second_try(
self, mock_logger, mock_tag_object, mock_prefix, mock_ipaddress_to_interface, mock_ip, mock_status
):
"""Test `create_device_type_object` Utility."""
mock_status().get.return_value = "mock_status"
mock_status(model=IPAddress).get.return_value = "mock_status"
mock_prefix.return_value = ("mock_prefix", False)
mock_ip.side_effect = [ValidationError("failure"), ValidationError("failure")]
logger = mock_logger("nb_job")
Expand Down

0 comments on commit f9cfc90

Please sign in to comment.