mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
tests: Prevent misuse of assert_in_success_response.
Changing assert_in_success_response to require List[Text] instead of
Iterable[Text] prevents the following misuse:
self.assert_in_response_success("message", response)
Currently, this will check whether 'm', 'e', 's', 'a', and 'g' separately
appear in the response, which is probably not the intended behavior. The
correct usage is as follows:
self.assert_in_response_success(["message"], response)
This commit is contained in:
@@ -370,7 +370,7 @@ class ZulipTestCase(TestCase):
|
||||
self.assertIn(substring, response.content.decode('utf-8'))
|
||||
|
||||
def assert_in_success_response(self, substrings, response):
|
||||
# type: (Iterable[Text], HttpResponse) -> None
|
||||
# type: (List[Text], HttpResponse) -> None
|
||||
self.assertEqual(response.status_code, 200)
|
||||
decoded = response.content.decode('utf-8')
|
||||
for substring in substrings:
|
||||
|
||||
Reference in New Issue
Block a user