From b9c570720b412f05906fb3ffda449af5f695de39 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 7 Dec 2022 17:07:17 +0000 Subject: [PATCH] test(tokens-repo): move null recovery token test to json tests Because the null state seems to be specific to json and not reproducible in abstract case. --- .../test_json_tokens_repository.py | 15 +++++++++++++++ .../test_repository/test_tokens_repository.py | 13 ------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tests/test_graphql/test_repository/test_json_tokens_repository.py b/tests/test_graphql/test_repository/test_json_tokens_repository.py index e90b3dc..a12c0de 100644 --- a/tests/test_graphql/test_repository/test_json_tokens_repository.py +++ b/tests/test_graphql/test_repository/test_json_tokens_repository.py @@ -13,6 +13,7 @@ from datetime import datetime from selfprivacy_api.models.tokens.token import Token from selfprivacy_api.repositories.tokens.exceptions import ( TokenNotFound, + RecoveryKeyNotFound, ) from selfprivacy_api.repositories.tokens.json_tokens_repository import ( JsonTokensRepository, @@ -26,6 +27,7 @@ from test_tokens_repository import ( mock_generate_token, mock_new_device_key_generate, empty_keys, + null_keys, ) @@ -82,6 +84,19 @@ def test_create_recovery_key(tokens, mock_recovery_key_generate): } +def test_use_mnemonic_recovery_key_when_null(null_keys): + repo = JsonTokensRepository() + + with pytest.raises(RecoveryKeyNotFound): + assert ( + repo.use_mnemonic_recovery_key( + mnemonic_phrase="captain ribbon toddler settle symbol minute step broccoli bless universe divide bulb", + device_name="primary_token", + ) + is None + ) + + def test_use_mnemonic_recovery_key(tokens, mock_generate_token): repo = JsonTokensRepository() diff --git a/tests/test_graphql/test_repository/test_tokens_repository.py b/tests/test_graphql/test_repository/test_tokens_repository.py index 6a745be..8fa6c47 100644 --- a/tests/test_graphql/test_repository/test_tokens_repository.py +++ b/tests/test_graphql/test_repository/test_tokens_repository.py @@ -399,19 +399,6 @@ def test_use_mnemonic_recovery_key_when_empty(empty_repo): ) -def test_use_menemonic_recovery_key_when_null(null_keys): - repo = JsonTokensRepository() - - with pytest.raises(RecoveryKeyNotFound): - assert ( - repo.use_mnemonic_recovery_key( - mnemonic_phrase="captain ribbon toddler settle symbol minute step broccoli bless universe divide bulb", - device_name="primary_token", - ) - is None - ) - - # agnostic test mixed with an implementation test def test_use_mnemonic_recovery_key(tokens, mock_generate_token): repo = JsonTokensRepository()