Skip to content

Commit

Permalink
Add test for /api/users/current creating a history
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Mar 15, 2024
1 parent d3e3efa commit 6b3c3f0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/galaxy_test/api/test_authenticate.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,28 @@ def test_anon_history_creation(self):
cookies=cookie,
)
assert second_histories_response.json()

def test_anon_history_creation_api(self):
# First request:
# We don't create any histories, just return a session cookie
response = get(self.url)
cookie = {"galaxysession": response.cookies["galaxysession"]}
# Check that we don't have any histories (API doesn't auto-create new histories)
histories_response = get(
urljoin(
self.url,
"api/histories",
)
)
assert not histories_response.json()
# Second request, we know client follows conventions by including cookies,
# default history is created.
get(urljoin(self.url, "api/users/current"), cookies=cookie).raise_for_status()
histories_response = get(
urljoin(
self.url,
"api/histories",
),
cookies=cookie,
)
assert histories_response.json()

0 comments on commit 6b3c3f0

Please sign in to comment.