Skip to content

Commit

Permalink
fix csrftoken
Browse files Browse the repository at this point in the history
No-Issue
  • Loading branch information
chr-stian committed Jul 28, 2024
1 parent 977cc2a commit 06f892b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions galaxy_ng/tests/integration/api/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ def test_gateway_create_ns_csrftoken(galaxy_client):
"""Test whether admin can create a namespace using an invalid csrftoken."""
gc = galaxy_client("admin")
alt_cookies = gc.gw_client.cookies
alt_cookies["csrftoken"] = uuid4()
alt_cookies["csrftoken"] = "f8QJ2hHGP3NS2HaNid10eoptnzWDvFqn" # wrong token
gc.headers["Cookie"] = (f"csrftoken={alt_cookies['csrftoken']};"
f" gateway_sessionid={alt_cookies['gateway_sessionid']}")
remove_from_cache("admin")
create_body = {"name": f"test_ns_{generate_random_string(4).lower()}", "groups": []}
with pytest.raises(GalaxyClientError) as ctx:
gc.post("v3/namespaces/", create_body, relogin=False)
assert ctx.value.response.status_code == 401
gc.post("v3/namespaces/", create_body, relogin=False, parse_json=False)
assert ctx.value.response.status_code == 403
remove_from_cache("admin")


Expand Down
1 change: 0 additions & 1 deletion galaxy_ng/tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ def set_test_data(ansible_config, hub_version):
else:
raise e
del gc.headers["Referer"]
del gc.headers["X-Csrftoken"]


@pytest.fixture(scope="session")
Expand Down

0 comments on commit 06f892b

Please sign in to comment.