Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 67 (Sourcery refactored) #130

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions netbox_acls/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Comment on lines -125 to -126
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AccessListSerializer.validate refactored with the following changes:

# Check that the GFK object is valid.
assigned_object = validate_gfk(data)

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion netbox_acls/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function AppTest.test_root refactored with the following changes:


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

Expand Down