Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrlyons committed Sep 6, 2024
1 parent 62c4937 commit 730865c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/tests/integration/websockets/test_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_websocket_endpoint_accepts_valid_token():
client = TestClient(app)
valid_token = jwt.encode({"sub": "test@example.com"}, "secret", algorithm="HS256")

with patch("jose.jwt.decode", return_value={"sub": "test@example.com"}):
with patch("jwt.decode", return_value={"sub": "test@example.com"}):
with patch("app.crud.get_user_by_username", return_value=MockUser()):
with patch("redis.Redis.ttl", return_value=3600):
with client.websocket_connect(
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_websocket_endpoint_closes_on_jwt_error_missing_algorithm():
valid_token = jwt.encode({"sub": "test@example.com"}, "secret", algorithm="HS256")

with pytest.raises(WebSocketDisconnect) as exc_info:
with patch("jose.jwt.decode", side_effect=jwt.JWTError("Missing algorithm")):
with patch("jwt.decode", side_effect=jwt.JWTError("Missing algorithm")):
with client.websocket_connect(
f"/api/ws/test@example.com?token={valid_token}"
) as websocket:
Expand Down

0 comments on commit 730865c

Please sign in to comment.