Skip to content

Commit

Permalink
UT: Strengthen the assertion in __fails_if_token_invalid()
Browse files Browse the repository at this point in the history
  • Loading branch information
mssalvatore committed Apr 3, 2023
1 parent 88091d5 commit a2ce7d3
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
AuthenticationFacade,
)
from monkey_island.cc.services.authentication_service.setup import setup_authentication
from monkey_island.cc.services.authentication_service.token import TokenGenerator, TokenParser
from monkey_island.cc.services.authentication_service.token import (
TokenGenerator,
TokenParser,
TokenValidationError,
)
from monkey_island.cc.services.authentication_service.user import User

USERNAME = "user1"
Expand Down Expand Up @@ -157,9 +161,9 @@ def test_generate_new_token_pair__fails_if_token_invalid(
user = User(username=USERNAME, password=PASSWORD, fs_uniquifier="a")
user.save()
refresh_token = authentication_facade.generate_refresh_token(user)
mock_token_parser.parse.side_effect = Exception()
mock_token_parser.parse.side_effect = TokenValidationError()

with pytest.raises(Exception):
with pytest.raises(TokenValidationError):
authentication_facade.generate_new_token_pair(refresh_token)


Expand Down

0 comments on commit a2ce7d3

Please sign in to comment.