Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 20, 2024
1 parent 39eff63 commit d5baa24
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/test_implicit_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ async def mock_middleware(request: Request, call_next):
mock_token = Mock()
mock_payload = Mock(time_until_expiry=100, sub="user123", extra_dict={})

with patch.object(
authx, "_get_token_from_request", return_value=mock_token
), patch.object(authx, "verify_token", return_value=mock_payload), patch.object(
authx, "create_access_token", return_value="new_token"
), patch.object(authx, "set_access_cookies"), patch.object(
authx, "_implicit_refresh_enabled_for_request", return_value=True
with (
patch.object(authx, "_get_token_from_request", return_value=mock_token),
patch.object(authx, "verify_token", return_value=mock_payload),
patch.object(authx, "create_access_token", return_value="new_token"),
patch.object(authx, "set_access_cookies"),
patch.object(authx, "_implicit_refresh_enabled_for_request", return_value=True),
):
response = client.get("/test")
assert response.status_code == 200
Expand All @@ -98,11 +98,12 @@ async def call_next(request):
mock_token = Mock()
mock_payload = Mock(time_until_expiry=100, sub="user123", extra_dict={})

with patch.object(
authx, "_get_token_from_request", return_value=mock_token
), patch.object(authx, "verify_token", return_value=mock_payload), patch.object(
authx, "create_access_token", return_value="new_token"
), patch.object(authx, "set_access_cookies"):
with (
patch.object(authx, "_get_token_from_request", return_value=mock_token),
patch.object(authx, "verify_token", return_value=mock_payload),
patch.object(authx, "create_access_token", return_value="new_token"),
patch.object(authx, "set_access_cookies"),
):
response = client.get("/test")
assert response.status_code == 200
assert response.json() == {"message": "success"}
Expand All @@ -124,13 +125,12 @@ async def call_next(request):
mock_token = Mock()
mock_payload = Mock(time_until_expiry=1000, sub="user123", extra_dict={})

with patch.object(
authx, "_get_token_from_request", return_value=mock_token
), patch.object(authx, "verify_token", return_value=mock_payload), patch.object(
authx, "create_access_token"
) as mock_create_token, patch.object(
authx, "set_access_cookies"
) as mock_set_cookies:
with (
patch.object(authx, "_get_token_from_request", return_value=mock_token),
patch.object(authx, "verify_token", return_value=mock_payload),
patch.object(authx, "create_access_token") as mock_create_token,
patch.object(authx, "set_access_cookies") as mock_set_cookies,
):
response = client.get("/test")
assert response.status_code == 200
assert response.json() == {"message": "success"}
Expand Down

0 comments on commit d5baa24

Please sign in to comment.