Skip to content

Commit 2a30223

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent fb4df7f commit 2a30223

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

omeroweb/decorators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def is_valid_public_url(self, server_id, request):
288288
)
289289
settings.PUBLIC_ENABLED = False
290290
return False
291-
if self.allowPublicPost and request.method == 'POST':
291+
if self.allowPublicPost and request.method == "POST":
292292
return settings.PUBLIC_URL_FILTER.search(request.path) is not None
293293
if settings.PUBLIC_GET_ONLY and (request.method != "GET"):
294294
return False

test/unit/test_login_required.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,28 @@ def test_is_valid_table_slice_call(monkeypatch):
166166
monkeypatch.setattr(settings, "PUBLIC_PASSWORD", "password", raising=False)
167167
monkeypatch.setattr(settings, "PUBLIC_GET_ONLY", True)
168168
monkeypatch.setattr(settings, "PUBLIC_URL_FILTER", re.compile("^/api"))
169-
assert decorator_allow_public_post.is_valid_public_url(1, rf.get("/webgateway/table/123/slice")) is False
170-
assert decorator_allow_public_post.is_valid_public_url(1, rf.post("/webgateway/table/123/slice")) is False
169+
assert (
170+
decorator_allow_public_post.is_valid_public_url(
171+
1, rf.get("/webgateway/table/123/slice")
172+
)
173+
is False
174+
)
175+
assert (
176+
decorator_allow_public_post.is_valid_public_url(
177+
1, rf.post("/webgateway/table/123/slice")
178+
)
179+
is False
180+
)
171181
monkeypatch.setattr(settings, "PUBLIC_URL_FILTER", re.compile("^/api|webgateway"))
172-
assert decorator_allow_public_post.is_valid_public_url(1, rf.get("/webgateway/table/123/slice")) is True
173-
assert decorator_allow_public_post.is_valid_public_url(1, rf.post("/webgateway/table/123/slice")) is True
182+
assert (
183+
decorator_allow_public_post.is_valid_public_url(
184+
1, rf.get("/webgateway/table/123/slice")
185+
)
186+
is True
187+
)
188+
assert (
189+
decorator_allow_public_post.is_valid_public_url(
190+
1, rf.post("/webgateway/table/123/slice")
191+
)
192+
is True
193+
)

0 commit comments

Comments
 (0)