mirror of https://github.com/zulip/zulip.git
Replace iago@zulip.com with example_email('iago').
This commit is contained in:
parent
5230eaef1c
commit
961b35d52e
|
@ -2063,7 +2063,7 @@ class TestAdminSetBackends(ZulipTestCase):
|
||||||
def test_change_enabled_backends(self):
|
def test_change_enabled_backends(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
# Log in as admin
|
# Log in as admin
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
result = self.client_patch("/json/realm", {
|
result = self.client_patch("/json/realm", {
|
||||||
'authentication_methods': ujson.dumps({u'Email': False, u'Dev': True})})
|
'authentication_methods': ujson.dumps({u'Email': False, u'Dev': True})})
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
@ -2074,7 +2074,7 @@ class TestAdminSetBackends(ZulipTestCase):
|
||||||
def test_disable_all_backends(self):
|
def test_disable_all_backends(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
# Log in as admin
|
# Log in as admin
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
result = self.client_patch("/json/realm", {
|
result = self.client_patch("/json/realm", {
|
||||||
'authentication_methods': ujson.dumps({u'Email': False, u'Dev': False})})
|
'authentication_methods': ujson.dumps({u'Email': False, u'Dev': False})})
|
||||||
self.assert_json_error(result, 'At least one authentication method must be enabled.', status_code=403)
|
self.assert_json_error(result, 'At least one authentication method must be enabled.', status_code=403)
|
||||||
|
@ -2085,7 +2085,7 @@ class TestAdminSetBackends(ZulipTestCase):
|
||||||
def test_supported_backends_only_updated(self):
|
def test_supported_backends_only_updated(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
# Log in as admin
|
# Log in as admin
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
# Set some supported and unsupported backends
|
# Set some supported and unsupported backends
|
||||||
result = self.client_patch("/json/realm", {
|
result = self.client_patch("/json/realm", {
|
||||||
'authentication_methods': ujson.dumps({u'Email': False, u'Dev': True, u'GitHub': False})})
|
'authentication_methods': ujson.dumps({u'Email': False, u'Dev': True, u'GitHub': False})})
|
||||||
|
|
|
@ -118,7 +118,7 @@ class TopicHistoryTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_bad_stream_id(self):
|
def test_bad_stream_id(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
email = 'iago@zulip.com'
|
email = self.example_email("iago")
|
||||||
self.login(email)
|
self.login(email)
|
||||||
|
|
||||||
# non-sensible stream id
|
# non-sensible stream id
|
||||||
|
@ -445,7 +445,7 @@ class StreamMessagesTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_not_too_many_queries(self):
|
def test_not_too_many_queries(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
recipient_list = [self.example_email("hamlet"), 'iago@zulip.com', 'cordelia@zulip.com', 'othello@zulip.com']
|
recipient_list = [self.example_email("hamlet"), self.example_email("iago"), 'cordelia@zulip.com', 'othello@zulip.com']
|
||||||
for email in recipient_list:
|
for email in recipient_list:
|
||||||
self.subscribe_to_stream(email, "Denmark")
|
self.subscribe_to_stream(email, "Denmark")
|
||||||
|
|
||||||
|
@ -1172,7 +1172,7 @@ class EditMessageTest(ZulipTestCase):
|
||||||
def test_edit_message_no_permission(self):
|
def test_edit_message_no_permission(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login(self.example_email("hamlet"))
|
self.login(self.example_email("hamlet"))
|
||||||
msg_id = self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM,
|
msg_id = self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM,
|
||||||
subject="editing", content="before edit")
|
subject="editing", content="before edit")
|
||||||
result = self.client_patch("/json/messages/" + str(msg_id), {
|
result = self.client_patch("/json/messages/" + str(msg_id), {
|
||||||
'message_id': msg_id,
|
'message_id': msg_id,
|
||||||
|
@ -1295,7 +1295,7 @@ class EditMessageTest(ZulipTestCase):
|
||||||
self.assertEqual(history[0]['prev_content'], 'content 3')
|
self.assertEqual(history[0]['prev_content'], 'content 3')
|
||||||
self.assertEqual(history[0]['user_id'], hamlet.id)
|
self.assertEqual(history[0]['user_id'], hamlet.id)
|
||||||
|
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
result = self.client_patch("/json/messages/" + str(msg_id), {
|
result = self.client_patch("/json/messages/" + str(msg_id), {
|
||||||
'message_id': msg_id,
|
'message_id': msg_id,
|
||||||
'subject': 'subject 4',
|
'subject': 'subject 4',
|
||||||
|
@ -1394,9 +1394,9 @@ class EditMessageTest(ZulipTestCase):
|
||||||
self.assert_json_error(result, error)
|
self.assert_json_error(result, error)
|
||||||
self.check_message(id_, subject=old_subject, content=old_content)
|
self.check_message(id_, subject=old_subject, content=old_content)
|
||||||
|
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
# send a message in the past
|
# send a message in the past
|
||||||
id_ = self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM,
|
id_ = self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM,
|
||||||
content="content", subject="subject")
|
content="content", subject="subject")
|
||||||
message = Message.objects.get(id=id_)
|
message = Message.objects.get(id=id_)
|
||||||
message.pub_date = message.pub_date - datetime.timedelta(seconds=180)
|
message.pub_date = message.pub_date - datetime.timedelta(seconds=180)
|
||||||
|
@ -1429,13 +1429,13 @@ class EditMessageTest(ZulipTestCase):
|
||||||
self.login(self.example_email("hamlet"))
|
self.login(self.example_email("hamlet"))
|
||||||
id1 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
id1 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id2 = self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM,
|
id2 = self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id3 = self.send_message("iago@zulip.com", "Rome", Recipient.STREAM,
|
id3 = self.send_message(self.example_email("iago"), "Rome", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id4 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
id4 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic2")
|
subject="topic2")
|
||||||
id5 = self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM,
|
id5 = self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
|
|
||||||
result = self.client_patch("/json/messages/" + str(id1), {
|
result = self.client_patch("/json/messages/" + str(id1), {
|
||||||
|
@ -1458,13 +1458,13 @@ class EditMessageTest(ZulipTestCase):
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id2 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
id2 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id3 = self.send_message("iago@zulip.com", "Rome", Recipient.STREAM,
|
id3 = self.send_message(self.example_email("iago"), "Rome", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id4 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
id4 = self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic2")
|
subject="topic2")
|
||||||
id5 = self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM,
|
id5 = self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic1")
|
subject="topic1")
|
||||||
id6 = self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM,
|
id6 = self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM,
|
||||||
subject="topic3")
|
subject="topic3")
|
||||||
|
|
||||||
result = self.client_patch("/json/messages/" + str(id2), {
|
result = self.client_patch("/json/messages/" + str(id2), {
|
||||||
|
|
|
@ -488,9 +488,9 @@ class GetOldMessagesTest(ZulipTestCase):
|
||||||
assert isinstance(dr, list)
|
assert isinstance(dr, list)
|
||||||
return ','.join(sorted(set([r['email'] for r in dr] + [me])))
|
return ','.join(sorted(set([r['email'] for r in dr] + [me])))
|
||||||
|
|
||||||
self.send_message(me, 'iago@zulip.com', Recipient.PERSONAL)
|
self.send_message(me, self.example_email("iago"), Recipient.PERSONAL)
|
||||||
self.send_message(me,
|
self.send_message(me,
|
||||||
['iago@zulip.com', 'cordelia@zulip.com'],
|
[self.example_email("iago"), 'cordelia@zulip.com'],
|
||||||
Recipient.HUDDLE)
|
Recipient.HUDDLE)
|
||||||
personals = [m for m in get_user_messages(self.example_user('hamlet'))
|
personals = [m for m in get_user_messages(self.example_user('hamlet'))
|
||||||
if m.recipient.type == Recipient.PERSONAL or
|
if m.recipient.type == Recipient.PERSONAL or
|
||||||
|
@ -514,13 +514,13 @@ class GetOldMessagesTest(ZulipTestCase):
|
||||||
me = self.example_email("hamlet")
|
me = self.example_email("hamlet")
|
||||||
|
|
||||||
matching_message_ids = []
|
matching_message_ids = []
|
||||||
matching_message_ids.append(self.send_message(me, ['iago@zulip.com', 'cordelia@zulip.com', 'othello@zulip.com'], Recipient.HUDDLE))
|
matching_message_ids.append(self.send_message(me, [self.example_email("iago"), 'cordelia@zulip.com', 'othello@zulip.com'], Recipient.HUDDLE))
|
||||||
matching_message_ids.append(self.send_message(me, ['cordelia@zulip.com', 'othello@zulip.com'], Recipient.HUDDLE))
|
matching_message_ids.append(self.send_message(me, ['cordelia@zulip.com', 'othello@zulip.com'], Recipient.HUDDLE))
|
||||||
|
|
||||||
non_matching_message_ids = []
|
non_matching_message_ids = []
|
||||||
non_matching_message_ids.append(self.send_message(me, 'cordelia@zulip.com', Recipient.PERSONAL))
|
non_matching_message_ids.append(self.send_message(me, 'cordelia@zulip.com', Recipient.PERSONAL))
|
||||||
non_matching_message_ids.append(self.send_message(me, ['iago@zulip.com', 'othello@zulip.com'], Recipient.HUDDLE))
|
non_matching_message_ids.append(self.send_message(me, [self.example_email("iago"), 'othello@zulip.com'], Recipient.HUDDLE))
|
||||||
non_matching_message_ids.append(self.send_message('cordelia@zulip.com', ['iago@zulip.com', 'othello@zulip.com'], Recipient.HUDDLE))
|
non_matching_message_ids.append(self.send_message('cordelia@zulip.com', [self.example_email("iago"), 'othello@zulip.com'], Recipient.HUDDLE))
|
||||||
|
|
||||||
self.login(me)
|
self.login(me)
|
||||||
narrow = [dict(operator='group-pm-with', operand='cordelia@zulip.com')]
|
narrow = [dict(operator='group-pm-with', operand='cordelia@zulip.com')]
|
||||||
|
@ -676,7 +676,7 @@ class GetOldMessagesTest(ZulipTestCase):
|
||||||
self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM)
|
self.send_message(self.example_email("hamlet"), "Scotland", Recipient.STREAM)
|
||||||
self.send_message("othello@zulip.com", "Scotland", Recipient.STREAM)
|
self.send_message("othello@zulip.com", "Scotland", Recipient.STREAM)
|
||||||
self.send_message("othello@zulip.com", self.example_email("hamlet"), Recipient.PERSONAL)
|
self.send_message("othello@zulip.com", self.example_email("hamlet"), Recipient.PERSONAL)
|
||||||
self.send_message("iago@zulip.com", "Scotland", Recipient.STREAM)
|
self.send_message(self.example_email("iago"), "Scotland", Recipient.STREAM)
|
||||||
|
|
||||||
narrow = [dict(operator='sender', operand='othello@zulip.com')]
|
narrow = [dict(operator='sender', operand='othello@zulip.com')]
|
||||||
result = self.get_and_check_messages(dict(narrow=ujson.dumps(narrow)))
|
result = self.get_and_check_messages(dict(narrow=ujson.dumps(narrow)))
|
||||||
|
@ -1090,7 +1090,7 @@ class GetOldMessagesTest(ZulipTestCase):
|
||||||
# Add a few messages that help us test that our query doesn't
|
# Add a few messages that help us test that our query doesn't
|
||||||
# look at messages that are irrelevant to Hamlet.
|
# look at messages that are irrelevant to Hamlet.
|
||||||
self.send_message("othello@zulip.com", "cordelia@zulip.com", Recipient.PERSONAL)
|
self.send_message("othello@zulip.com", "cordelia@zulip.com", Recipient.PERSONAL)
|
||||||
self.send_message("othello@zulip.com", "iago@zulip.com", Recipient.PERSONAL)
|
self.send_message("othello@zulip.com", self.example_email("iago"), Recipient.PERSONAL)
|
||||||
|
|
||||||
query_params = dict(
|
query_params = dict(
|
||||||
use_first_unread_anchor='true',
|
use_first_unread_anchor='true',
|
||||||
|
|
|
@ -142,7 +142,7 @@ class ReactionMessageIDTest(ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
pm_sender = self.example_email("hamlet")
|
pm_sender = self.example_email("hamlet")
|
||||||
pm_recipient = 'othello@zulip.com'
|
pm_recipient = 'othello@zulip.com'
|
||||||
reaction_sender = 'iago@zulip.com'
|
reaction_sender = self.example_email("iago")
|
||||||
|
|
||||||
result = self.client_post("/api/v1/messages", {"type": "private",
|
result = self.client_post("/api/v1/messages", {"type": "private",
|
||||||
"content": "Test message",
|
"content": "Test message",
|
||||||
|
|
|
@ -67,7 +67,7 @@ class RealmTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_update_realm_description(self):
|
def test_update_realm_description(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
email = 'iago@zulip.com'
|
email = self.example_email("iago")
|
||||||
self.login(email)
|
self.login(email)
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
new_description = u'zulip dev group'
|
new_description = u'zulip dev group'
|
||||||
|
@ -93,7 +93,7 @@ class RealmTest(ZulipTestCase):
|
||||||
data = dict(description=ujson.dumps(new_description))
|
data = dict(description=ujson.dumps(new_description))
|
||||||
|
|
||||||
# create an admin user
|
# create an admin user
|
||||||
email = 'iago@zulip.com'
|
email = self.example_email("iago")
|
||||||
self.login(email)
|
self.login(email)
|
||||||
|
|
||||||
result = self.client_patch('/json/realm', data)
|
result = self.client_patch('/json/realm', data)
|
||||||
|
@ -158,7 +158,7 @@ class RealmTest(ZulipTestCase):
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
self.assertNotEqual(realm.default_language, new_lang)
|
self.assertNotEqual(realm.default_language, new_lang)
|
||||||
# we need an admin user.
|
# we need an admin user.
|
||||||
email = 'iago@zulip.com'
|
email = self.example_email("iago")
|
||||||
self.login(email)
|
self.login(email)
|
||||||
|
|
||||||
req = dict(default_language=ujson.dumps(new_lang))
|
req = dict(default_language=ujson.dumps(new_lang))
|
||||||
|
|
|
@ -20,7 +20,7 @@ import ujson
|
||||||
class RealmDomainTest(ZulipTestCase):
|
class RealmDomainTest(ZulipTestCase):
|
||||||
def test_list_realm_domains(self):
|
def test_list_realm_domains(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
RealmDomain.objects.create(realm=realm, domain='acme.com', allow_subdomains=True)
|
RealmDomain.objects.create(realm=realm, domain='acme.com', allow_subdomains=True)
|
||||||
result = self.client_get("/json/realm/domains")
|
result = self.client_get("/json/realm/domains")
|
||||||
|
@ -43,7 +43,7 @@ class RealmDomainTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_create_realm_domain(self):
|
def test_create_realm_domain(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
data = {'domain': ujson.dumps(''),
|
data = {'domain': ujson.dumps(''),
|
||||||
'allow_subdomains': ujson.dumps(True)}
|
'allow_subdomains': ujson.dumps(True)}
|
||||||
result = self.client_post("/json/realm/domains", info=data)
|
result = self.client_post("/json/realm/domains", info=data)
|
||||||
|
@ -72,7 +72,7 @@ class RealmDomainTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_patch_realm_domain(self):
|
def test_patch_realm_domain(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
RealmDomain.objects.create(realm=realm, domain='acme.com',
|
RealmDomain.objects.create(realm=realm, domain='acme.com',
|
||||||
allow_subdomains=False)
|
allow_subdomains=False)
|
||||||
|
@ -92,7 +92,7 @@ class RealmDomainTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_delete_realm_domain(self):
|
def test_delete_realm_domain(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
RealmDomain.objects.create(realm=realm, domain='acme.com')
|
RealmDomain.objects.create(realm=realm, domain='acme.com')
|
||||||
result = self.client_delete("/json/realm/domains/non-existent.com")
|
result = self.client_delete("/json/realm/domains/non-existent.com")
|
||||||
|
@ -106,7 +106,7 @@ class RealmDomainTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_delete_all_realm_domains(self):
|
def test_delete_all_realm_domains(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
query = RealmDomain.objects.filter(realm=realm)
|
query = RealmDomain.objects.filter(realm=realm)
|
||||||
|
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ class DeactivateUserTest(ZulipTestCase):
|
||||||
|
|
||||||
def test_do_not_deactivate_final_admin(self):
|
def test_do_not_deactivate_final_admin(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
email = 'iago@zulip.com'
|
email = self.example_email("iago")
|
||||||
self.login(email)
|
self.login(email)
|
||||||
user = self.example_user('iago')
|
user = self.example_user('iago')
|
||||||
self.assertTrue(user.is_active)
|
self.assertTrue(user.is_active)
|
||||||
|
@ -1705,7 +1705,7 @@ class TestFindMyTeam(ZulipTestCase):
|
||||||
result = self.client_get(url)
|
result = self.client_get(url)
|
||||||
content = result.content.decode('utf8')
|
content = result.content.decode('utf8')
|
||||||
self.assertIn("Emails sent! You will only receive emails", content)
|
self.assertIn("Emails sent! You will only receive emails", content)
|
||||||
self.assertIn("iago@zulip.com", content)
|
self.assertIn(self.example_email("iago"), content)
|
||||||
self.assertIn("cordelia@zulip.com", content)
|
self.assertIn("cordelia@zulip.com", content)
|
||||||
|
|
||||||
def test_find_team_ignore_invalid_email(self):
|
def test_find_team_ignore_invalid_email(self):
|
||||||
|
@ -1714,7 +1714,7 @@ class TestFindMyTeam(ZulipTestCase):
|
||||||
result = self.client_get(url)
|
result = self.client_get(url)
|
||||||
content = result.content.decode('utf8')
|
content = result.content.decode('utf8')
|
||||||
self.assertIn("Emails sent! You will only receive emails", content)
|
self.assertIn("Emails sent! You will only receive emails", content)
|
||||||
self.assertIn("iago@zulip.com", content)
|
self.assertIn(self.example_email("iago"), content)
|
||||||
self.assertNotIn("invalid_email", content)
|
self.assertNotIn("invalid_email", content)
|
||||||
|
|
||||||
def test_find_team_zero_emails(self):
|
def test_find_team_zero_emails(self):
|
||||||
|
|
|
@ -1303,8 +1303,8 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
|
|
||||||
{"msg": "",
|
{"msg": "",
|
||||||
"result": "success",
|
"result": "success",
|
||||||
"already_subscribed": {"iago@zulip.com": ["Venice", "Verona"]},
|
"already_subscribed": {self.example_email("iago"): ["Venice", "Verona"]},
|
||||||
"subscribed": {"iago@zulip.com": ["Venice8"]}}
|
"subscribed": {self.example_email("iago"): ["Venice8"]}}
|
||||||
"""
|
"""
|
||||||
result = self.common_subscribe_to_streams(self.test_email, subscriptions,
|
result = self.common_subscribe_to_streams(self.test_email, subscriptions,
|
||||||
other_params, invite_only=invite_only)
|
other_params, invite_only=invite_only)
|
||||||
|
@ -1366,7 +1366,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
||||||
"""
|
"""
|
||||||
invitee = "iago@zulip.com"
|
invitee = self.example_email("iago")
|
||||||
|
|
||||||
current_stream = self.get_streams(invitee)[0]
|
current_stream = self.get_streams(invitee)[0]
|
||||||
invite_streams = self.make_random_stream_names([current_stream])[:1]
|
invite_streams = self.make_random_stream_names([current_stream])[:1]
|
||||||
|
@ -1385,7 +1385,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
||||||
"""
|
"""
|
||||||
invitee = "iago@zulip.com"
|
invitee = self.example_email("iago")
|
||||||
invitee_full_name = 'Iago'
|
invitee_full_name = 'Iago'
|
||||||
|
|
||||||
current_stream = self.get_streams(invitee)[0]
|
current_stream = self.get_streams(invitee)[0]
|
||||||
|
@ -1459,7 +1459,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
Calling POST /json/users/me/subscriptions should notify when a new stream is created.
|
||||||
"""
|
"""
|
||||||
invitee = "iago@zulip.com"
|
invitee = self.example_email("iago")
|
||||||
invitee_full_name = 'Iago'
|
invitee_full_name = 'Iago'
|
||||||
|
|
||||||
current_stream = self.get_streams(invitee)[0]
|
current_stream = self.get_streams(invitee)[0]
|
||||||
|
@ -1572,7 +1572,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
def test_multi_user_subscription(self):
|
def test_multi_user_subscription(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
email1 = 'cordelia@zulip.com'
|
email1 = 'cordelia@zulip.com'
|
||||||
email2 = 'iago@zulip.com'
|
email2 = self.example_email("iago")
|
||||||
realm = get_realm("zulip")
|
realm = get_realm("zulip")
|
||||||
streams_to_sub = ['multi_user_stream']
|
streams_to_sub = ['multi_user_stream']
|
||||||
events = [] # type: List[Dict[str, Any]]
|
events = [] # type: List[Dict[str, Any]]
|
||||||
|
@ -1711,7 +1711,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
streams_to_sub,
|
streams_to_sub,
|
||||||
dict(principals=ujson.dumps(users_to_subscribe)))
|
dict(principals=ujson.dumps(users_to_subscribe)))
|
||||||
|
|
||||||
new_users_to_subscribe = ["iago@zulip.com", "cordelia@zulip.com"]
|
new_users_to_subscribe = [self.example_email("iago"), "cordelia@zulip.com"]
|
||||||
events = [] # type: List[Dict[str, Any]]
|
events = [] # type: List[Dict[str, Any]]
|
||||||
with tornado_redirected_to_list(events):
|
with tornado_redirected_to_list(events):
|
||||||
self.common_subscribe_to_streams(
|
self.common_subscribe_to_streams(
|
||||||
|
@ -1743,7 +1743,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||||
email1 = 'othello@zulip.com'
|
email1 = 'othello@zulip.com'
|
||||||
email2 = 'cordelia@zulip.com'
|
email2 = 'cordelia@zulip.com'
|
||||||
email3 = 'hamlet@zulip.com'
|
email3 = 'hamlet@zulip.com'
|
||||||
email4 = 'iago@zulip.com'
|
email4 = self.example_email("iago")
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
|
|
||||||
stream1 = self.make_stream('stream1')
|
stream1 = self.make_stream('stream1')
|
||||||
|
|
|
@ -164,9 +164,9 @@ class UnreadCountTests(ZulipTestCase):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.unread_msg_ids = [
|
self.unread_msg_ids = [
|
||||||
self.send_message(
|
self.send_message(
|
||||||
"iago@zulip.com", self.example_email("hamlet"), Recipient.PERSONAL, "hello"),
|
self.example_email("iago"), self.example_email("hamlet"), Recipient.PERSONAL, "hello"),
|
||||||
self.send_message(
|
self.send_message(
|
||||||
"iago@zulip.com", self.example_email("hamlet"), Recipient.PERSONAL, "hello2")]
|
self.example_email("iago"), self.example_email("hamlet"), Recipient.PERSONAL, "hello2")]
|
||||||
|
|
||||||
# Sending a new message results in unread UserMessages being created
|
# Sending a new message results in unread UserMessages being created
|
||||||
def test_new_message(self):
|
def test_new_message(self):
|
||||||
|
@ -215,7 +215,7 @@ class UnreadCountTests(ZulipTestCase):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login(self.example_email("hamlet"))
|
self.login(self.example_email("hamlet"))
|
||||||
|
|
||||||
message_ids = [self.send_message(self.example_email("hamlet"), "iago@zulip.com",
|
message_ids = [self.send_message(self.example_email("hamlet"), self.example_email("iago"),
|
||||||
Recipient.PERSONAL, "test"),
|
Recipient.PERSONAL, "test"),
|
||||||
self.send_message(self.example_email("hamlet"), "cordelia@zulip.com",
|
self.send_message(self.example_email("hamlet"), "cordelia@zulip.com",
|
||||||
Recipient.PERSONAL, "test2")]
|
Recipient.PERSONAL, "test2")]
|
||||||
|
|
|
@ -516,7 +516,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
|
|
||||||
def test_file_download_authorization_invite_only(self):
|
def test_file_download_authorization_invite_only(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
subscribed_users = [self.example_email("hamlet"), "iago@zulip.com"]
|
subscribed_users = [self.example_email("hamlet"), self.example_email("iago")]
|
||||||
unsubscribed_users = ["othello@zulip.com", "prospero@zulip.com"]
|
unsubscribed_users = ["othello@zulip.com", "prospero@zulip.com"]
|
||||||
for user in subscribed_users:
|
for user in subscribed_users:
|
||||||
self.subscribe_to_stream(user, "test-subscribe")
|
self.subscribe_to_stream(user, "test-subscribe")
|
||||||
|
@ -556,7 +556,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
|
|
||||||
def test_file_download_authorization_public(self):
|
def test_file_download_authorization_public(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
subscribed_users = [self.example_email("hamlet"), "iago@zulip.com"]
|
subscribed_users = [self.example_email("hamlet"), self.example_email("iago")]
|
||||||
unsubscribed_users = ["othello@zulip.com", "prospero@zulip.com"]
|
unsubscribed_users = ["othello@zulip.com", "prospero@zulip.com"]
|
||||||
for user in subscribed_users:
|
for user in subscribed_users:
|
||||||
self.subscribe_to_stream(user, "test-subscribe")
|
self.subscribe_to_stream(user, "test-subscribe")
|
||||||
|
@ -798,7 +798,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
Attempting to upload two files should fail.
|
Attempting to upload two files should fail.
|
||||||
"""
|
"""
|
||||||
# Log in as admin
|
# Log in as admin
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
with get_test_image_file('img.png') as fp1, \
|
with get_test_image_file('img.png') as fp1, \
|
||||||
get_test_image_file('img.png') as fp2:
|
get_test_image_file('img.png') as fp2:
|
||||||
result = self.client_put_multipart("/json/realm/icon", {'f1': fp1, 'f2': fp2})
|
result = self.client_put_multipart("/json/realm/icon", {'f1': fp1, 'f2': fp2})
|
||||||
|
@ -809,7 +809,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
Calling this endpoint with no files should fail.
|
Calling this endpoint with no files should fail.
|
||||||
"""
|
"""
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
|
|
||||||
result = self.client_put_multipart("/json/realm/icon")
|
result = self.client_put_multipart("/json/realm/icon")
|
||||||
self.assert_json_error(result, "You must upload exactly one icon.")
|
self.assert_json_error(result, "You must upload exactly one icon.")
|
||||||
|
@ -865,7 +865,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
for fname, rfname in self.correct_files:
|
for fname, rfname in self.correct_files:
|
||||||
# TODO: use self.subTest once we're exclusively on python 3 by uncommenting the line below.
|
# TODO: use self.subTest once we're exclusively on python 3 by uncommenting the line below.
|
||||||
# with self.subTest(fname=fname):
|
# with self.subTest(fname=fname):
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
with get_test_image_file(fname) as fp:
|
with get_test_image_file(fname) as fp:
|
||||||
result = self.client_put_multipart("/json/realm/icon", {'file': fp})
|
result = self.client_put_multipart("/json/realm/icon", {'file': fp})
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
|
@ -888,7 +888,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
for fname in self.corrupt_files:
|
for fname in self.corrupt_files:
|
||||||
# with self.subTest(fname=fname):
|
# with self.subTest(fname=fname):
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
with get_test_image_file(fname) as fp:
|
with get_test_image_file(fname) as fp:
|
||||||
result = self.client_put_multipart("/json/realm/icon", {'file': fp})
|
result = self.client_put_multipart("/json/realm/icon", {'file': fp})
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
"""
|
"""
|
||||||
A DELETE request to /json/realm/icon should delete the realm icon and return gravatar URL
|
A DELETE request to /json/realm/icon should delete the realm icon and return gravatar URL
|
||||||
"""
|
"""
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
realm.icon_source = Realm.ICON_UPLOADED
|
realm.icon_source = Realm.ICON_UPLOADED
|
||||||
realm.save()
|
realm.save()
|
||||||
|
@ -915,7 +915,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
|
|
||||||
def test_realm_icon_version(self):
|
def test_realm_icon_version(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
realm = get_realm('zulip')
|
realm = get_realm('zulip')
|
||||||
icon_version = realm.icon_version
|
icon_version = realm.icon_version
|
||||||
self.assertEqual(icon_version, 1)
|
self.assertEqual(icon_version, 1)
|
||||||
|
@ -926,7 +926,7 @@ class RealmIconTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
|
|
||||||
def test_realm_icon_upload_file_size_error(self):
|
def test_realm_icon_upload_file_size_error(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.login("iago@zulip.com")
|
self.login(self.example_email("iago"))
|
||||||
with get_test_image_file(self.correct_files[0][0]) as fp:
|
with get_test_image_file(self.correct_files[0][0]) as fp:
|
||||||
with self.settings(MAX_ICON_FILE_SIZE=0):
|
with self.settings(MAX_ICON_FILE_SIZE=0):
|
||||||
result = self.client_put_multipart("/json/realm/icon", {'file': fp})
|
result = self.client_put_multipart("/json/realm/icon", {'file': fp})
|
||||||
|
|
|
@ -111,7 +111,7 @@ class PermissionTest(ZulipTestCase):
|
||||||
self.assertEqual(person['is_admin'], False)
|
self.assertEqual(person['is_admin'], False)
|
||||||
|
|
||||||
# Cannot take away from last admin
|
# Cannot take away from last admin
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
req = dict(is_admin=ujson.dumps(False))
|
req = dict(is_admin=ujson.dumps(False))
|
||||||
events = []
|
events = []
|
||||||
with tornado_redirected_to_list(events):
|
with tornado_redirected_to_list(events):
|
||||||
|
@ -134,7 +134,7 @@ class PermissionTest(ZulipTestCase):
|
||||||
def test_admin_user_can_change_full_name(self):
|
def test_admin_user_can_change_full_name(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
new_name = 'new name'
|
new_name = 'new name'
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
req = dict(full_name=ujson.dumps(new_name))
|
req = dict(full_name=ujson.dumps(new_name))
|
||||||
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
||||||
self.assertTrue(result.status_code == 200)
|
self.assertTrue(result.status_code == 200)
|
||||||
|
@ -151,7 +151,7 @@ class PermissionTest(ZulipTestCase):
|
||||||
def test_admin_cannot_set_long_full_name(self):
|
def test_admin_cannot_set_long_full_name(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
new_name = 'a' * (UserProfile.MAX_NAME_LENGTH + 1)
|
new_name = 'a' * (UserProfile.MAX_NAME_LENGTH + 1)
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
req = dict(full_name=ujson.dumps(new_name))
|
req = dict(full_name=ujson.dumps(new_name))
|
||||||
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
||||||
self.assert_json_error(result, 'Name too long!')
|
self.assert_json_error(result, 'Name too long!')
|
||||||
|
@ -159,7 +159,7 @@ class PermissionTest(ZulipTestCase):
|
||||||
def test_admin_cannot_set_short_full_name(self):
|
def test_admin_cannot_set_short_full_name(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
new_name = 'a'
|
new_name = 'a'
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
req = dict(full_name=ujson.dumps(new_name))
|
req = dict(full_name=ujson.dumps(new_name))
|
||||||
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
||||||
self.assert_json_error(result, 'Name too short!')
|
self.assert_json_error(result, 'Name too short!')
|
||||||
|
@ -167,7 +167,7 @@ class PermissionTest(ZulipTestCase):
|
||||||
def test_admin_cannot_set_full_name_with_invalid_characters(self):
|
def test_admin_cannot_set_full_name_with_invalid_characters(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
new_name = 'Opheli*'
|
new_name = 'Opheli*'
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
req = dict(full_name=ujson.dumps(new_name))
|
req = dict(full_name=ujson.dumps(new_name))
|
||||||
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
result = self.client_patch('/json/users/hamlet@zulip.com', req)
|
||||||
self.assert_json_error(result, 'Invalid characters in name!')
|
self.assert_json_error(result, 'Invalid characters in name!')
|
||||||
|
@ -289,7 +289,7 @@ class ActivateTest(ZulipTestCase):
|
||||||
"""This test helps ensure that our URL patterns for /users/me URLs
|
"""This test helps ensure that our URL patterns for /users/me URLs
|
||||||
handle email addresses starting with "me" correctly."""
|
handle email addresses starting with "me" correctly."""
|
||||||
self.register(self.nonreg_email('me'), "testpassword")
|
self.register(self.nonreg_email('me'), "testpassword")
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
|
|
||||||
result = self.client_delete('/json/users/me@zulip.com')
|
result = self.client_delete('/json/users/me@zulip.com')
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
@ -396,10 +396,10 @@ class GetProfileTest(ZulipTestCase):
|
||||||
self.assertIn("user_id", result)
|
self.assertIn("user_id", result)
|
||||||
self.assertFalse(result['is_bot'])
|
self.assertFalse(result['is_bot'])
|
||||||
self.assertFalse(result['is_admin'])
|
self.assertFalse(result['is_admin'])
|
||||||
self.login('iago@zulip.com')
|
self.login(self.example_email("iago"))
|
||||||
result = ujson.loads(self.client_get('/json/users/me').content)
|
result = ujson.loads(self.client_get('/json/users/me').content)
|
||||||
self.assertEqual(result['short_name'], 'iago')
|
self.assertEqual(result['short_name'], 'iago')
|
||||||
self.assertEqual(result['email'], 'iago@zulip.com')
|
self.assertEqual(result['email'], self.example_email("iago"))
|
||||||
self.assertEqual(result['full_name'], 'Iago')
|
self.assertEqual(result['full_name'], 'Iago')
|
||||||
self.assertFalse(result['is_bot'])
|
self.assertFalse(result['is_bot'])
|
||||||
self.assertTrue(result['is_admin'])
|
self.assertTrue(result['is_admin'])
|
||||||
|
|
Loading…
Reference in New Issue