mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 17:26:46 +00:00
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.
This commit is contained in:
parent
732e72d414
commit
b9c570720b
|
@ -13,6 +13,7 @@ from datetime import datetime
|
||||||
from selfprivacy_api.models.tokens.token import Token
|
from selfprivacy_api.models.tokens.token import Token
|
||||||
from selfprivacy_api.repositories.tokens.exceptions import (
|
from selfprivacy_api.repositories.tokens.exceptions import (
|
||||||
TokenNotFound,
|
TokenNotFound,
|
||||||
|
RecoveryKeyNotFound,
|
||||||
)
|
)
|
||||||
from selfprivacy_api.repositories.tokens.json_tokens_repository import (
|
from selfprivacy_api.repositories.tokens.json_tokens_repository import (
|
||||||
JsonTokensRepository,
|
JsonTokensRepository,
|
||||||
|
@ -26,6 +27,7 @@ from test_tokens_repository import (
|
||||||
mock_generate_token,
|
mock_generate_token,
|
||||||
mock_new_device_key_generate,
|
mock_new_device_key_generate,
|
||||||
empty_keys,
|
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):
|
def test_use_mnemonic_recovery_key(tokens, mock_generate_token):
|
||||||
repo = JsonTokensRepository()
|
repo = JsonTokensRepository()
|
||||||
|
|
||||||
|
|
|
@ -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
|
# agnostic test mixed with an implementation test
|
||||||
def test_use_mnemonic_recovery_key(tokens, mock_generate_token):
|
def test_use_mnemonic_recovery_key(tokens, mock_generate_token):
|
||||||
repo = JsonTokensRepository()
|
repo = JsonTokensRepository()
|
||||||
|
|
Loading…
Reference in a new issue