From bf6c230ae08c01aa97316ac31bce182143948edf Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 14 Dec 2022 17:41:47 +0000 Subject: [PATCH] fix(tokens-repo): raise token not found when deleting nonexistent token even if device name exists --- selfprivacy_api/repositories/tokens/redis_tokens_repository.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfprivacy_api/repositories/tokens/redis_tokens_repository.py b/selfprivacy_api/repositories/tokens/redis_tokens_repository.py index be3615f..8432709 100644 --- a/selfprivacy_api/repositories/tokens/redis_tokens_repository.py +++ b/selfprivacy_api/repositories/tokens/redis_tokens_repository.py @@ -39,6 +39,8 @@ class RedisTokensRepository(AbstractTokensRepository): """Delete the token""" r = self.connection key = RedisTokensRepository._token_redis_key(input_token) + if input_token not in self.get_tokens(): + raise TokenNotFound r.delete(key) def reset(self):