mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-20 11:19:15 +00:00
fix(tokens-repository): use_mnemonic_new_device_key() now stores a token
This commit is contained in:
parent
4498003aca
commit
2797c6f88f
|
@ -147,7 +147,7 @@ class JsonTokensRepository(AbstractTokensRepository):
|
|||
if not self._assert_mnemonic(new_device_key.key, mnemonic_phrase):
|
||||
raise NewDeviceKeyNotFound("Phrase is not token!")
|
||||
|
||||
new_token = Token.generate(device_name=device_name)
|
||||
new_token = self.create_token(device_name=device_name)
|
||||
self.delete_new_device_key()
|
||||
|
||||
return new_token
|
||||
|
|
|
@ -499,13 +499,13 @@ def test_use_mnemonic_new_device_key(
|
|||
repo = empty_repo
|
||||
assert repo.get_new_device_key() is not None
|
||||
|
||||
assert (
|
||||
repo.use_mnemonic_new_device_key(
|
||||
new_token = repo.use_mnemonic_new_device_key(
|
||||
device_name="imnew",
|
||||
mnemonic_phrase="captain ribbon toddler settle symbol minute step broccoli bless universe divide bulb",
|
||||
)
|
||||
is not None
|
||||
)
|
||||
|
||||
assert new_token.device_name == "imnew"
|
||||
assert new_token in repo.get_tokens()
|
||||
|
||||
# we must delete the key after use
|
||||
with pytest.raises(NewDeviceKeyNotFound):
|
||||
|
|
Loading…
Reference in a new issue