From 55ad2484b82238c6df70f7d53a5cd45df92d201b Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 7 Dec 2022 12:10:50 +0000 Subject: [PATCH] test(tokens-repo): agnostic test for getting by name --- .../test_repository/test_tokens_repository.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/test_graphql/test_repository/test_tokens_repository.py b/tests/test_graphql/test_repository/test_tokens_repository.py index cfeddb3..8e1b8e3 100644 --- a/tests/test_graphql/test_repository/test_tokens_repository.py +++ b/tests/test_graphql/test_repository/test_tokens_repository.py @@ -213,19 +213,15 @@ def test_get_token_by_non_existent_token_string(some_tokens_repo): assert repo.get_token_by_token_string(token_string="iamBadtoken") is None -def test_get_token_by_name(tokens): - repo = JsonTokensRepository() +def test_get_token_by_name(some_tokens_repo): + repo = some_tokens_repo assert repo.get_token_by_name(token_name="primary_token") is not None - assert repo.get_token_by_name(token_name="primary_token") == Token( - token="KG9ni-B-CMPk327Zv1qC7YBQaUGaBUcgdkvMvQ2atFI", - device_name="primary_token", - created_at=datetime(2022, 7, 15, 17, 41, 31, 675698), - ) + assert repo.get_token_by_name(token_name="primary_token") == repo.get_tokens()[0] -def test_get_token_by_non_existent_name(tokens): - repo = JsonTokensRepository() +def test_get_token_by_non_existent_name(some_tokens_repo): + repo = some_tokens_repo with pytest.raises(TokenNotFound): assert repo.get_token_by_name(token_name="badname") is None