Skip to content

Commit cfbca6a

Browse files
author
Sourcery AI
committed
'Refactored by Sourcery'
1 parent 5aec756 commit cfbca6a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

netbox_acls/api/serializers.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ def validate(self, data):
122122
- Check that the GFK object is valid.
123123
- Check if Access List has no existing rules before change the Access List's type.
124124
"""
125-
error_message = {}
126-
127125
# Check that the GFK object is valid.
128126
assigned_object = validate_gfk(data)
129127

@@ -137,7 +135,7 @@ def validate(self, data):
137135
{"type": ["This ACL has ACL rules associated, CANNOT change ACL type."]}
138136
)
139137

140-
if error_message:
138+
if error_message := {}:
141139
raise serializers.ValidationError(error_message)
142140

143141
return super().validate(data)

netbox_acls/tests/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_root(self):
1818
Test the API root
1919
"""
2020
url = reverse("plugins-api:netbox_acls-api:api-root")
21-
response = self.client.get("{}?format=api".format(url), **self.header)
21+
response = self.client.get(f"{url}?format=api", **self.header)
2222

2323
self.assertEqual(response.status_code, status.HTTP_200_OK)
2424

0 commit comments

Comments
 (0)