diff --git a/netbox_acls/api/serializers.py b/netbox_acls/api/serializers.py index 46f24cb..ce6b1f6 100644 --- a/netbox_acls/api/serializers.py +++ b/netbox_acls/api/serializers.py @@ -122,8 +122,6 @@ def validate(self, data): - Check that the GFK object is valid. - Check if Access List has no existing rules before change the Access List's type. """ - error_message = {} - # Check that the GFK object is valid. assigned_object = validate_gfk(data) @@ -137,7 +135,7 @@ def validate(self, data): {"type": ["This ACL has ACL rules associated, CANNOT change ACL type."]} ) - if error_message: + if error_message := {}: raise serializers.ValidationError(error_message) return super().validate(data) diff --git a/netbox_acls/tests/test_api.py b/netbox_acls/tests/test_api.py index 2dd5745..d44371d 100644 --- a/netbox_acls/tests/test_api.py +++ b/netbox_acls/tests/test_api.py @@ -18,7 +18,7 @@ def test_root(self): Test the API root """ url = reverse("plugins-api:netbox_acls-api:api-root") - response = self.client.get("{}?format=api".format(url), **self.header) + response = self.client.get(f"{url}?format=api", **self.header) self.assertEqual(response.status_code, status.HTTP_200_OK)