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:
Elliott Jin
2017-03-18 14:48:44 -07:00
committed by Tim Abbott
parent a2d948f2e0
commit fde1aa506b
3 changed files with 9 additions and 9 deletions

View File

@@ -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: