Skip to content

Commit

Permalink
Reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Mar 18, 2024
1 parent 48d0d88 commit ab8acec
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
6 changes: 3 additions & 3 deletions tcms/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class ExtraHeadersMiddleware(MiddlewareMixin):

def process_response(self, request, response):
if settings.DEBUG:
response.headers[
"Content-Security-Policy"
] = "script-src 'self' cdn.crowdin.com plausible.io;"
response.headers["Content-Security-Policy"] = (
"script-src 'self' cdn.crowdin.com plausible.io;"
)

if request.path.find("/uploads/") > -1:
response.headers["Content-Type"] = "text/plain"
Expand Down
18 changes: 9 additions & 9 deletions tcms/rpc/tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ def test_update_other_with_proper_permission(self):
def test_update_own_password(self):
user_new_attrs = self.user_new_attrs.copy()
new_password = "new password" # nosec:B105:hardcoded_password_string
user_new_attrs[
"password" # nosec:B105:hardcoded_password_string
] = new_password
user_new_attrs["password"] = ( # nosec:B105:hardcoded_password_string
new_password
)

with self.assertRaisesRegex(XmlRPCFault, "Old password is required"):
self.rpc_client.User.update(self.api_user.pk, user_new_attrs)
Expand All @@ -177,9 +177,9 @@ def test_update_own_password(self):
with self.assertRaisesRegex(XmlRPCFault, "Password is incorrect"):
self.rpc_client.User.update(self.api_user.pk, user_new_attrs)

user_new_attrs[
"old_password" # nosec:B105:hardcoded_password_string
] = "api-testing"
user_new_attrs["old_password"] = ( # nosec:B105:hardcoded_password_string
"api-testing"
)
data = self.rpc_client.User.update(self.api_user.pk, user_new_attrs)
self.assertNotIn("password", data)
self.assertEqual(data["first_name"], user_new_attrs["first_name"])
Expand All @@ -193,9 +193,9 @@ def test_update_another_user_password(self):
user_should_have_perm(self.api_user, "auth.change_user")

user_new_attrs = self.user_new_attrs.copy()
user_new_attrs[
"password" # nosec:B105:hardcoded_password_string
] = "new password"
user_new_attrs["password"] = ( # nosec:B105:hardcoded_password_string
"new password"
)

with self.assertRaisesRegex(
XmlRPCFault, "Password updates for other users are not allowed via RPC!"
Expand Down
16 changes: 10 additions & 6 deletions tcms/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,11 @@
("-", "-"),
(_("New Test Run"), reverse_lazy("testruns-new")),
("-", "-") if "tcms.bugs.apps.AppConfig" in INSTALLED_APPS else (),
(_("New Bug"), reverse_lazy("bugs-new"))
if "tcms.bugs.apps.AppConfig" in INSTALLED_APPS
else (),
(
(_("New Bug"), reverse_lazy("bugs-new"))
if "tcms.bugs.apps.AppConfig" in INSTALLED_APPS
else ()
),
],
),
(
Expand All @@ -393,9 +395,11 @@
(_("Search Test Plans"), reverse_lazy("plans-search")),
(_("Search Test Cases"), reverse_lazy("testcases-search")),
(_("Search Test Runs"), reverse_lazy("testruns-search")),
(_("Search Bugs"), reverse_lazy("bugs-search"))
if "tcms.bugs.apps.AppConfig" in INSTALLED_APPS
else (),
(
(_("Search Bugs"), reverse_lazy("bugs-search"))
if "tcms.bugs.apps.AppConfig" in INSTALLED_APPS
else ()
),
],
),
(
Expand Down
1 change: 1 addition & 0 deletions tcms/utils/secrets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helper module which deals with loading values from ENV or Docker Secrets.
"""

import os


Expand Down
1 change: 1 addition & 0 deletions tests/set_testadmin_pass.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Allow testadmin to log in by setting its password
"""

from django.contrib.auth.models import User

from tcms.management.models import Classification, Product, Version
Expand Down

0 comments on commit ab8acec

Please sign in to comment.