tests: Add assert_url_serves_contents_of_file() to ZulipTestCase

Add `assert_url_serves_contents_of_file()` in `ZulipTestCase` class
and deduplicate some codes.

Fixes #1276.
This commit is contained in:
Rafid Aslam
2016-12-19 22:17:19 +07:00
committed by showell
parent 64f595b061
commit 5cc8838df4
2 changed files with 8 additions and 6 deletions

View File

@@ -273,6 +273,12 @@ class ZulipTestCase(TestCase):
return [subscription.user_profile for subscription in subscriptions]
def assert_url_serves_contents_of_file(self, url, result):
# type: (str, bytes) -> None
response = self.client_get(url)
data = b"".join(response.streaming_content)
self.assertEquals(result, data)
def assert_json_success(self, result):
# type: (HttpResponse) -> Dict[str, Any]
"""