From 0fa4fdcff9a2a43c63a5ee462f52e7f5be2ba705 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Tue, 4 Dec 2018 15:17:02 -0800 Subject: [PATCH] compatibility: Rewrite verbose test for compact legibility. This will facilitate adding a bunch more test cases shortly. --- zerver/tests/test_compatibility.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zerver/tests/test_compatibility.py b/zerver/tests/test_compatibility.py index ea48b10340..3aff84b018 100644 --- a/zerver/tests/test_compatibility.py +++ b/zerver/tests/test_compatibility.py @@ -1,4 +1,6 @@ +from django.http import HttpResponse + from zerver.lib.test_classes import ZulipTestCase from zerver.views.compatibility import find_mobile_os, version_lt @@ -59,7 +61,8 @@ class VersionTest(ZulipTestCase): class CompatibilityTest(ZulipTestCase): def test_compatibility(self) -> None: - result = self.client_get("/compatibility", HTTP_USER_AGENT='ZulipMobile/5.0') - self.assert_json_success(result) - result = self.client_get("/compatibility", HTTP_USER_AGENT='ZulipInvalid/5.0') - self.assert_json_error(result, "Client is too old") + def get(user_agent: str) -> HttpResponse: + return self.client_get("/compatibility", HTTP_USER_AGENT=user_agent) + + self.assert_json_success(get('ZulipMobile/5.0')) + self.assert_json_error(get('ZulipInvalid/5.0'), "Client is too old")