From 13b9dd33fa0b3eced55c9995c3fa0bd75852d63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yago=20Gonz=C3=A1lez?= Date: Sun, 29 Jul 2018 18:04:40 +0200 Subject: [PATCH] test_decorators: Explain typo-looking expression. The validate_api_key sentence may look a bit confusing since we are using webhook_bot's email address but default_bot's API key. At first sight, and without any context on these tests, it may look like that's just a typo, but we do want it to be like it is right now because that way the API key used doesn't correspond to the provided email address (triggering some untested parts of our backend logic). --- zerver/tests/test_decorators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.py index ce1e13230b..b605a1f24f 100644 --- a/zerver/tests/test_decorators.py +++ b/zerver/tests/test_decorators.py @@ -1069,6 +1069,9 @@ class TestValidateApiKey(ZulipTestCase): validate_api_key(HostRequestMock(), self.webhook_bot.email, 'not_32_length') with self.assertRaises(JsonableError): + # We use default_bot's key but webhook_bot's email address to test + # the logic when an API key is passed and it doesn't belong to the + # user whose email address has been provided. validate_api_key(HostRequestMock(), self.webhook_bot.email, self.default_bot.api_key) def test_validate_api_key_if_profile_is_not_active(self) -> None: