Use assert_in_response by fixing line-wrapping in templates.

This commit is contained in:
Eklavya Sharma 2016-07-13 02:45:27 +05:30 committed by Tim Abbott
parent 235162e000
commit e28b038f1d
3 changed files with 6 additions and 7 deletions

View File

@ -5,9 +5,8 @@
<p>{{ _('Hi there! Thank you for your interest in Zulip') }}.</p> <p>{{ _('Hi there! Thank you for your interest in Zulip') }}.</p>
<p>{% trans %} The organization you are trying to join, {{ deactivated_domain_name }}, has <p>{% trans %} The organization you are trying to join, {{ deactivated_domain_name }}, has been deactivated.
been deactivated. Please Please contact <a href="mailto:{{ zulip_administrator }}">{{ zulip_administrator }}</a> to reactivate
contact <a href="mailto:{{ zulip_administrator }}">{{ zulip_administrator }}</a> to reactivate
this group{% endtrans %}.</p> this group{% endtrans %}.</p>
{% endblock %} {% endblock %}

View File

@ -462,7 +462,7 @@ class DeactivatedRealmTest(AuthedTestCase):
""" """
do_deactivate_realm(get_realm("zulip.com")) do_deactivate_realm(get_realm("zulip.com"))
result = self.login_with_return("hamlet@zulip.com") result = self.login_with_return("hamlet@zulip.com")
self.assertIn("has been deactivated", result.content.decode('utf-8').replace("\n", " ")) self.assert_in_response("has been deactivated", result)
def test_webhook_deactivated_realm(self): def test_webhook_deactivated_realm(self):
""" """
@ -590,7 +590,7 @@ class InactiveUserTest(AuthedTestCase):
do_deactivate_user(user_profile) do_deactivate_user(user_profile)
result = self.login_with_return("hamlet@zulip.com") result = self.login_with_return("hamlet@zulip.com")
self.assertIn("Please enter a correct email and password", result.content.decode('utf-8').replace("\n", " ")) self.assert_in_response("Please enter a correct email and password", result)
def test_webhook_deactivated_user(self): def test_webhook_deactivated_user(self):
""" """

View File

@ -157,7 +157,7 @@ class LoginTest(AuthedTestCase):
realm.save(update_fields=["deactivated"]) realm.save(update_fields=["deactivated"])
result = self.register("test", "test") result = self.register("test", "test")
self.assertIn("has been deactivated", result.content.decode('utf-8').replace("\n", " ")) self.assert_in_response("has been deactivated", result)
with self.assertRaises(UserProfile.DoesNotExist): with self.assertRaises(UserProfile.DoesNotExist):
get_user_profile_by_email('test@zulip.com') get_user_profile_by_email('test@zulip.com')
@ -172,7 +172,7 @@ class LoginTest(AuthedTestCase):
realm.save(update_fields=["deactivated"]) realm.save(update_fields=["deactivated"])
result = self.login_with_return("hamlet@zulip.com") result = self.login_with_return("hamlet@zulip.com")
self.assertIn("has been deactivated", result.content.decode('utf-8').replace("\n", " ")) self.assert_in_response("has been deactivated", result)
def test_logout(self): def test_logout(self):
# type: () -> None # type: () -> None