From 1fe1270f2ad49db25e40a91d1cca9ba8fc4a1cdb Mon Sep 17 00:00:00 2001 From: Justin Drew <2396364+jdrew82@users.noreply.github.com> Date: Wed, 15 Nov 2023 09:33:51 -0600 Subject: [PATCH] =?UTF-8?q?test:=20=E2=9C=85=20Add=20test=20validating=20N?= =?UTF-8?q?autobotSubnet.create()=20functionality=20with=20setting=20conta?= =?UTF-8?q?iner=20type.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/device42/unit/test_models_nautobot_ipam.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nautobot_ssot/tests/device42/unit/test_models_nautobot_ipam.py b/nautobot_ssot/tests/device42/unit/test_models_nautobot_ipam.py index d9b56f451..5feda476b 100644 --- a/nautobot_ssot/tests/device42/unit/test_models_nautobot_ipam.py +++ b/nautobot_ssot/tests/device42/unit/test_models_nautobot_ipam.py @@ -113,7 +113,7 @@ def setUp(self): def test_create(self): """Validate the NautobotSubnet create() method creates a Prefix.""" self.prefix.delete() - ids = {"network": "10.0.0.0", "mask_bits": "24", "vrf": "Test"} + ids = {"network": "10.0.0.0", "mask_bits": 24, "vrf": "Test"} attrs = {"description": "", "tags": ["Test"], "custom_fields": {"Test": {"key": "Test", "value": "test"}}} result = ipam.NautobotSubnet.create(self.diffsync, ids, attrs) self.assertIsInstance(result, ipam.NautobotSubnet) @@ -125,6 +125,16 @@ def test_create(self): self.assertEqual(list(subnet.tags.names()), attrs["tags"]) self.assertEqual(subnet.custom_field_data["Test"], "test") + def test_create_container_type(self): + """Validate the NautobotSubnet.create() functionality with setting Prefix to container type.""" + self.prefix.delete() + ids = {"network": "0.0.0.0", "mask_bits": 0, "vrf": "Test"} # nosec + attrs = {"description": "", "tags": [], "custom_fields": {}} + result = ipam.NautobotSubnet.create(self.diffsync, ids, attrs) + self.assertIsInstance(result, ipam.NautobotSubnet) + subnet = Prefix.objects.get(prefix=f"{ids['network']}/{ids['mask_bits']}", namespace=self.test_ns) + self.assertEqual(subnet.type, "container") + def test_update(self): """Validate the NautobotSubnet update() method updates a Prefix.""" test_pf = ipam.NautobotSubnet(