tests: Add AssertNotIn helper to the base test class.

This commit is contained in:
K.Kanakhin 2017-04-10 16:35:56 +06:00 committed by Tim Abbott
parent 179913fcf2
commit 3d4020fd1c
1 changed files with 7 additions and 0 deletions

View File

@ -378,6 +378,13 @@ class ZulipTestCase(TestCase):
for substring in substrings: for substring in substrings:
self.assertIn(substring, decoded) self.assertIn(substring, decoded)
def assert_not_in_success_response(self, substrings, response):
# type: (List[Text], HttpResponse) -> None
self.assertEqual(response.status_code, 200)
decoded = response.content.decode('utf-8')
for substring in substrings:
self.assertNotIn(substring, decoded)
def fixture_data(self, type, action, file_type='json'): def fixture_data(self, type, action, file_type='json'):
# type: (Text, Text, Text) -> Text # type: (Text, Text, Text) -> Text
return force_text(open(os.path.join(os.path.dirname(__file__), return force_text(open(os.path.join(os.path.dirname(__file__),