Page MenuHomeSoftware Heritage

D3145.diff
No OneTemporary

D3145.diff

diff --git a/swh/web/common/service.py b/swh/web/common/service.py
--- a/swh/web/common/service.py
+++ b/swh/web/common/service.py
@@ -31,10 +31,10 @@
MAX_LIMIT = 50 # Top limit the users can ask for
-def _first_element(l):
+def _first_element(lst):
"""Returns the first element in the provided list or None
if it is empty or None"""
- return next(iter(l or []), None)
+ return next(iter(lst or []), None)
def lookup_multiple_hashes(hashes):
diff --git a/swh/web/tests/auth/test_api_auth.py b/swh/web/tests/auth/test_api_auth.py
--- a/swh/web/tests/auth/test_api_auth.py
+++ b/swh/web/tests/auth/test_api_auth.py
@@ -82,7 +82,7 @@
# check for failed authentication when token format is invalid
mock_keycloak(mocker)
- api_client.credentials(HTTP_AUTHORIZATION=f"Bearer invalid-token-format")
+ api_client.credentials(HTTP_AUTHORIZATION="Bearer invalid-token-format")
response = api_client.get(url)
request = response.wsgi_request
@@ -106,7 +106,7 @@
assert isinstance(request.user, AnonymousUser)
# invalid authorization type
- api_client.credentials(HTTP_AUTHORIZATION=f"Foo token")
+ api_client.credentials(HTTP_AUTHORIZATION="Foo token")
response = api_client.get(url)
request = response.wsgi_request
diff --git a/swh/web/tests/auth/test_backends.py b/swh/web/tests/auth/test_backends.py
--- a/swh/web/tests/auth/test_backends.py
+++ b/swh/web/tests/auth/test_backends.py
@@ -121,7 +121,7 @@
mock_keycloak(mocker)
request = api_request_factory.get(
- url, HTTP_AUTHORIZATION=f"Bearer invalid-token-format"
+ url, HTTP_AUTHORIZATION="Bearer invalid-token-format"
)
with pytest.raises(AuthenticationFailed):
@@ -136,7 +136,7 @@
access_token = sample_data.oidc_profile["access_token"]
# Invalid authorization type
- request = api_request_factory.get(url, HTTP_AUTHORIZATION=f"Foo token")
+ request = api_request_factory.get(url, HTTP_AUTHORIZATION="Foo token")
with pytest.raises(AuthenticationFailed):
drf_auth_backend.authenticate(request)
diff --git a/swh/web/tests/browse/views/test_origin.py b/swh/web/tests/browse/views/test_origin.py
--- a/swh/web/tests/browse/views/test_origin.py
+++ b/swh/web/tests/browse/views/test_origin.py
@@ -672,7 +672,7 @@
"origin": origin["url"],
"visit": get_swh_persistent_id(SNAPSHOT, snapshot["id"]),
"anchor": get_swh_persistent_id(RELEASE, release_data["id"]),
- "path": f"/",
+ "path": "/",
}
swh_dir_id = get_swh_persistent_id(

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 2:03 PM (8 h, 20 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3214689

Event Timeline