Skip to content

Commit

Permalink
Use .name instead of .key for cookie tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KentShikama committed Jul 27, 2023
1 parent f14ffb7 commit 343a3bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/backend/tests/endpoints/test_oeci_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_oeci_login_success(service, monkeypatch):
service.client.post("/api/oeci_login", json={"oeci_username": "correctname", "oeci_password": "correctpwd"})
credentials_cookie_string = None
for cookie in service.client.cookie_jar:
if cookie.key == "oeci_token":
if cookie.name == "oeci_token":
credentials_cookie_string = cookie.value
break
creds = service.cipher.decrypt(credentials_cookie_string)
Expand Down
6 changes: 3 additions & 3 deletions src/backend/tests/endpoints/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_search(service, monkeypatch):
"/api/oeci_login", json={"oeci_username": "correctusername", "oeci_password": "correctpassword"}
)

assert any(cookie.key == "oeci_token" for cookie in service.client.cookie_jar)
assert any(cookie.name == "oeci_token" for cookie in service.client.cookie_jar)

response = service.client.post("/api/search", json=service.search_request_data)
assert response.status_code == 200
Expand All @@ -92,7 +92,7 @@ def test_search_creates_save_search_event(service, monkeypatch):
service.client.post(
"/api/oeci_login", json={"oeci_username": "correctusername", "oeci_password": "correctpassword"}
)
assert any(cookie.key == "oeci_token" for cookie in service.client.cookie_jar)
assert any(cookie.name == "oeci_token" for cookie in service.client.cookie_jar)

response = service.client.post("/api/search", json=service.search_request_data)

Expand All @@ -111,7 +111,7 @@ def test_search_with_failing_save_event(service, monkeypatch):
service.client.post(
"/api/oeci_login", json={"oeci_username": "correctusername", "oeci_password": "correctpassword"}
)
assert any(cookie.key == "oeci_token" for cookie in service.client.cookie_jar)
assert any(cookie.name == "oeci_token" for cookie in service.client.cookie_jar)

response = service.client.post("/api/search", json=service.search_request_data)

Expand Down

0 comments on commit 343a3bf

Please sign in to comment.