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

ruff fix #1346

Merged
merged 2 commits into from
Jan 9, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/backend-linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install ruff
working-directory: ${{env.working-directory}}
run: |
python -m pip install ruff
python -m pip install ruff==0.9.0
- name: Run ruff format check
working-directory: ${{env.working-directory}}
run: ruff format --check .
Expand Down
18 changes: 9 additions & 9 deletions backend/app_tests/api/test_api_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def test_import_frameworks(self, test):
lib_detail_response = lib_detail_response["framework"]

# Asserts that the library is not already loaded
assert (
Framework.objects.all().count() == 0
), "libraries are already loaded in the database"
assert Framework.objects.all().count() == 0, (
"libraries are already loaded in the database"
)
EndpointTestsQueries.Auth.get_object(
test.client,
"Frameworks",
Expand Down Expand Up @@ -114,9 +114,9 @@ def test_delete_frameworks(self, test):
"""test to delete frameworks with the API with authentication"""

EndpointTestsQueries.Auth.import_object(test.admin_client, "Framework")
assert (
Framework.objects.all().count() == 1
), "Frameworks are not correctly imported in the database"
assert Framework.objects.all().count() == 1, (
"Frameworks are not correctly imported in the database"
)

EndpointTestsQueries.Auth.delete_object(
test.client,
Expand All @@ -140,9 +140,9 @@ def test_import_risk_matrix(self, test):
lib_detail_response = lib_detail_response["risk_matrix"][0]

# Asserts that the library is not already loaded
assert (
RiskMatrix.objects.all().count() == 0
), "libraries are already loaded in the database"
assert RiskMatrix.objects.all().count() == 0, (
"libraries are already loaded in the database"
)
EndpointTestsQueries.Auth.get_object(
test.client, "Risk matrices", user_group=test.user_group
)
Expand Down
6 changes: 3 additions & 3 deletions backend/app_tests/api/test_api_user_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ def test_group_permissions(self, test):
User.objects.get(email=TEST_USER_EMAIL)
)
for perm in GROUPS_PERMISSIONS[test.user_group]["perms"]:
assert (
perm in user_permissions.keys()
), f"Permission {perm} not found in user permissions (group: {test.user_group})"
assert perm in user_permissions.keys(), (
f"Permission {perm} not found in user permissions (group: {test.user_group})"
)
24 changes: 12 additions & 12 deletions backend/app_tests/api/test_api_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def test_uniqueness_emails(self, test):
response = test.admin_client.post(url, data, format="json")

# Asserts that the user was not created
assert (
response.status_code == status.HTTP_400_BAD_REQUEST
), "users can be created with an already used email"
assert response.json() == {
"email": ["user with this email already exists."]
}, "users can be created with an already used email"
assert response.status_code == status.HTTP_400_BAD_REQUEST, (
"users can be created with an already used email"
)
assert response.json() == {"email": ["user with this email already exists."]}, (
"users can be created with an already used email"
)

def test_invalid_emails(self, test):
"""test to create users with the API with authentication and invalid emails"""
Expand All @@ -182,9 +182,9 @@ def test_invalid_emails(self, test):
response = test.admin_client.post(url, data, format="json")

# Asserts that the user was not created
assert (
response.status_code == status.HTTP_400_BAD_REQUEST
), f"users can be created with an invalid email ({email})"
assert response.json() == {
"email": ["Enter a valid email address."]
}, f"users can be created with an invalid email ({email})"
assert response.status_code == status.HTTP_400_BAD_REQUEST, (
f"users can be created with an invalid email ({email})"
)
assert response.json() == {"email": ["Enter a valid email address."]}, (
f"users can be created with an invalid email ({email})"
)
Loading
Loading