tests: Fix passing non-unicode strings to do_set_realm_property.

This fixes test failures on Python 3 caused by
a98bce98c6.
This commit is contained in:
Tim Abbott 2017-03-23 18:37:12 -07:00
parent 35f3070927
commit adcf8263d6
3 changed files with 10 additions and 10 deletions

View File

@ -604,7 +604,7 @@ class EventsRegisterTest(ZulipTestCase):
('value', check_string),
])
events = self.do_test(
lambda: do_set_realm_property(self.user_profile.realm, 'name', 'New Realm Name'))
lambda: do_set_realm_property(self.user_profile.realm, 'name', u'New Realm Name'))
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
@ -617,7 +617,7 @@ class EventsRegisterTest(ZulipTestCase):
('value', check_string),
])
events = self.do_test(
lambda: do_set_realm_property(self.user_profile.realm, 'description', 'New Realm Description'))
lambda: do_set_realm_property(self.user_profile.realm, 'description', u'New Realm Description'))
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
@ -802,7 +802,7 @@ class EventsRegisterTest(ZulipTestCase):
('value', check_string),
])
events = self.do_test(
lambda: do_set_realm_property(self.user_profile.realm, 'default_language', 'de'))
lambda: do_set_realm_property(self.user_profile.realm, 'default_language', u'de'))
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)

View File

@ -31,7 +31,7 @@ class RealmTest(ZulipTestCase):
by checking the cache to ensure that the new value is there."""
get_user_profile_by_email('hamlet@zulip.com')
realm = get_realm('zulip')
new_name = 'Zed You Elle Eye Pea'
new_name = u'Zed You Elle Eye Pea'
do_set_realm_property(realm, 'name', new_name)
self.assertEqual(get_realm(realm.string_id).name, new_name)
self.assert_user_profile_cache_gets_new_name('hamlet@zulip.com', new_name)
@ -39,7 +39,7 @@ class RealmTest(ZulipTestCase):
def test_update_realm_name_events(self):
# type: () -> None
realm = get_realm('zulip')
new_name = 'Puliz'
new_name = u'Puliz'
events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events):
do_set_realm_property(realm, 'name', new_name)
@ -54,7 +54,7 @@ class RealmTest(ZulipTestCase):
def test_update_realm_description_events(self):
# type: () -> None
realm = get_realm('zulip')
new_description = 'zulip dev group'
new_description = u'zulip dev group'
events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events):
do_set_realm_property(realm, 'description', new_description)
@ -71,7 +71,7 @@ class RealmTest(ZulipTestCase):
email = 'iago@zulip.com'
self.login(email)
realm = get_realm('zulip')
new_description = 'zulip dev group'
new_description = u'zulip dev group'
data = dict(description=ujson.dumps(new_description))
events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events):
@ -90,7 +90,7 @@ class RealmTest(ZulipTestCase):
def test_realm_description_length(self):
# type: () -> None
new_description = 'A' * 101
new_description = u'A' * 101
data = dict(description=ujson.dumps(new_description))
# create an admin user
@ -104,7 +104,7 @@ class RealmTest(ZulipTestCase):
def test_update_realm_api(self):
# type: () -> None
new_name = 'Zulip: Worldwide Exporter of APIs'
new_name = u'Zulip: Worldwide Exporter of APIs'
email = 'cordelia@zulip.com'
self.login(email)

View File

@ -945,7 +945,7 @@ class UserSignUpTest(ZulipTestCase):
email = "newguy@zulip.com"
password = "newpassword"
realm = get_realm('zulip')
do_set_realm_property(realm, 'default_language', "de")
do_set_realm_property(realm, 'default_language', u"de")
result = self.client_post('/accounts/home/', {'email': email})
self.assertEqual(result.status_code, 302)