mirror of https://github.com/zulip/zulip.git
test users: Add an escape char to a test username.
Changed the name of the test-user cordelia from `Cordelia Lear` to `Cordelia, Lear's daughter`. This change will enable us to test users with escape characters in their names. I also updated the Node, Puppeteer, Backend tests and Fixtures to support this change.
This commit is contained in:
parent
d99e2d5a3a
commit
146b32d63a
|
@ -213,7 +213,7 @@ const othello = {
|
|||
const cordelia = {
|
||||
email: "cordelia@zulip.com",
|
||||
user_id: 102,
|
||||
full_name: "Cordelia Lear",
|
||||
full_name: "Cordelia, Lear's daughter",
|
||||
};
|
||||
const deactivated_user = {
|
||||
email: "other@zulip.com",
|
||||
|
@ -763,7 +763,7 @@ test("initialize", (override) => {
|
|||
// Adds a `no break-space` at the end. This should fail
|
||||
// if there wasn't any logic replacing `no break-space`
|
||||
// with normal space.
|
||||
query = "cordelia" + String.fromCharCode(160);
|
||||
query = "cordelia, lear's" + String.fromCharCode(160);
|
||||
assert.equal(matcher(query, cordelia), true);
|
||||
assert.equal(matcher(query, othello), false);
|
||||
|
||||
|
@ -783,7 +783,7 @@ test("initialize", (override) => {
|
|||
|
||||
options.query = "othello@zulip.com, cor";
|
||||
actual_value = options.updater(cordelia, event);
|
||||
assert.equal(appended_name, "Cordelia Lear");
|
||||
assert.equal(appended_name, "Cordelia, Lear's daughter");
|
||||
|
||||
const click_event = {type: "click", target: "#doesnotmatter"};
|
||||
options.query = "othello";
|
||||
|
@ -1468,8 +1468,8 @@ test("typeahead_results", () => {
|
|||
assert_emoji_matches("notaemoji", []);
|
||||
// Autocomplete user mentions by user name.
|
||||
assert_mentions_matches("cordelia", [cordelia]);
|
||||
assert_mentions_matches("cordelia le", [cordelia]);
|
||||
assert_mentions_matches("cordelia le ", []);
|
||||
assert_mentions_matches("cordelia, le", [cordelia]);
|
||||
assert_mentions_matches("cordelia, le ", []);
|
||||
assert_mentions_matches("King ", [hamlet, lear]);
|
||||
assert_mentions_matches("King H", [hamlet]);
|
||||
assert_mentions_matches("King L", [lear]);
|
||||
|
|
|
@ -58,7 +58,7 @@ emoji.initialize(emoji_params);
|
|||
fenced_code.initialize(pygments_data);
|
||||
|
||||
const cordelia = {
|
||||
full_name: "Cordelia Lear",
|
||||
full_name: "Cordelia, Lear's daughter",
|
||||
user_id: 101,
|
||||
email: "cordelia@zulip.com",
|
||||
};
|
||||
|
@ -266,7 +266,7 @@ test("message_flags", () => {
|
|||
assert(!message.mentioned);
|
||||
assert(!message.mentioned_me_directly);
|
||||
|
||||
message = {raw_content: "@**Cordelia Lear**"};
|
||||
message = {raw_content: "@**Cordelia, Lear's daughter**"};
|
||||
markdown.apply_markdown(message);
|
||||
assert(message.mentioned);
|
||||
assert(message.mentioned_me_directly);
|
||||
|
@ -326,9 +326,9 @@ test("marked", () => {
|
|||
expected: "<blockquote>\n<p>quote this for me</p>\n</blockquote>\n<p>thanks</p>",
|
||||
},
|
||||
{
|
||||
input: "This is a @**CordeLIA Lear** mention",
|
||||
input: "This is a @**CordeLIA, Lear's daughter** mention",
|
||||
expected:
|
||||
'<p>This is a <span class="user-mention" data-user-id="101">@Cordelia Lear</span> mention</p>',
|
||||
'<p>This is a <span class="user-mention" data-user-id="101">@Cordelia, Lear's daughter</span> mention</p>',
|
||||
},
|
||||
{
|
||||
input: "These @ @**** are not mentions",
|
||||
|
@ -387,15 +387,15 @@ test("marked", () => {
|
|||
'<p><span aria-label="poop" class="emoji emoji-1f4a9" role="img" title="poop">:poop:</span></p>',
|
||||
},
|
||||
{
|
||||
input: "Silent mention: @_**Cordelia Lear**",
|
||||
input: "Silent mention: @_**Cordelia, Lear's daughter**",
|
||||
expected:
|
||||
'<p>Silent mention: <span class="user-mention silent" data-user-id="101">Cordelia Lear</span></p>',
|
||||
'<p>Silent mention: <span class="user-mention silent" data-user-id="101">Cordelia, Lear's daughter</span></p>',
|
||||
},
|
||||
{
|
||||
input:
|
||||
"> Mention in quote: @**Cordelia Lear**\n\nMention outside quote: @**Cordelia Lear**",
|
||||
"> Mention in quote: @**Cordelia, Lear's daughter**\n\nMention outside quote: @**Cordelia, Lear's daughter**",
|
||||
expected:
|
||||
'<blockquote>\n<p>Mention in quote: <span class="user-mention silent" data-user-id="101">Cordelia Lear</span></p>\n</blockquote>\n<p>Mention outside quote: <span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>',
|
||||
'<blockquote>\n<p>Mention in quote: <span class="user-mention silent" data-user-id="101">Cordelia, Lear's daughter</span></p>\n</blockquote>\n<p>Mention outside quote: <span class="user-mention" data-user-id="101">@Cordelia, Lear's daughter</span></p>',
|
||||
},
|
||||
// Test only those linkifiers which don't return True for
|
||||
// `contains_backend_only_syntax()`. Those which return True
|
||||
|
@ -422,9 +422,9 @@ test("marked", () => {
|
|||
'<p>T<br>\n<a class="stream" data-stream-id="1" href="/#narrow/stream/1-Denmark">#Denmark</a></p>',
|
||||
},
|
||||
{
|
||||
input: "T\n@**Cordelia Lear**",
|
||||
input: "T\n@**Cordelia, Lear's daughter**",
|
||||
expected:
|
||||
'<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>',
|
||||
'<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia, Lear's daughter</span></p>',
|
||||
},
|
||||
{
|
||||
input: "@**Mark Twin|104** and @**Mark Twin|105** are out to confuse you.",
|
||||
|
@ -433,8 +433,8 @@ test("marked", () => {
|
|||
},
|
||||
{input: "@**Invalid User|1234**", expected: "<p>@**Invalid User|1234**</p>"},
|
||||
{
|
||||
input: "@**Cordelia LeAR|103** has a wrong user_id.",
|
||||
expected: "<p>@**Cordelia LeAR|103** has a wrong user_id.</p>",
|
||||
input: "@**Cordelia, Lear's daughter|103** has a wrong user_id.",
|
||||
expected: "<p>@**Cordelia, Lear's daughter|103** has a wrong user_id.</p>",
|
||||
},
|
||||
{
|
||||
input: "@**Brother of Bobby|123** is really the full name.",
|
||||
|
@ -642,7 +642,7 @@ test("message_flags", () => {
|
|||
|
||||
assert.equal(message.is_me_message, true);
|
||||
|
||||
input = "testing this @**all** @**Cordelia Lear**";
|
||||
input = "testing this @**all** @**Cordelia, Lear's daughter**";
|
||||
message = {topic: "No links here", raw_content: input};
|
||||
markdown.apply_markdown(message);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class CommonUtils {
|
|||
};
|
||||
|
||||
fullname: Record<string, string> = {
|
||||
cordelia: "Cordelia Lear",
|
||||
cordelia: "Cordelia, Lear's daughter",
|
||||
othello: "Othello, the Moor of Venice",
|
||||
hamlet: "King Hamlet",
|
||||
};
|
||||
|
@ -406,7 +406,7 @@ class CommonUtils {
|
|||
* This method returns a array, which is formmated as:
|
||||
* [
|
||||
* ['stream > topic', ['message 1', 'message 2']],
|
||||
* ['You and Cordelia Lear', ['message 1', 'message 2']]
|
||||
* ['You and Cordelia, Lear's daughter', ['message 1', 'message 2']]
|
||||
* ]
|
||||
*
|
||||
* The messages are sorted chronologically.
|
||||
|
|
|
@ -112,13 +112,13 @@ async function test_open_close_compose_box(page: Page): Promise<void> {
|
|||
|
||||
async function test_narrow_to_private_messages_with_cordelia(page: Page): Promise<void> {
|
||||
const you_and_cordelia_selector =
|
||||
'*[title="Narrow to your private messages with Cordelia Lear"]';
|
||||
'*[title="Narrow to your private messages with Cordelia, Lear\'s daughter"]';
|
||||
// For some unknown reason page.click() isn't working here.
|
||||
await page.evaluate(
|
||||
(selector: string) => document.querySelector<HTMLElement>(selector)!.click(),
|
||||
you_and_cordelia_selector,
|
||||
);
|
||||
const cordelia_user_id = await common.get_user_id_from_name(page, "Cordelia Lear");
|
||||
const cordelia_user_id = await common.get_user_id_from_name(page, "Cordelia, Lear's daughter");
|
||||
const pm_list_selector = `li[data-user-ids-string="${cordelia_user_id}"].expanded_private_message.active-sub-filter`;
|
||||
await page.waitForSelector(pm_list_selector, {visible: true});
|
||||
await close_compose_box(page);
|
||||
|
|
|
@ -104,7 +104,7 @@ async function test_previously_created_drafts_rendered(page: Page): Promise<void
|
|||
page,
|
||||
".draft-row .message_header_private_message .stream_label",
|
||||
),
|
||||
"You and Cordelia Lear, King Hamlet",
|
||||
"You and Cordelia, Lear's daughter, King Hamlet",
|
||||
);
|
||||
assert.strictEqual(
|
||||
await common.get_text_from_selector(
|
||||
|
@ -183,7 +183,7 @@ async function test_restore_private_message_draft(page: Page): Promise<void> {
|
|||
await common.pm_recipient.expect(page, `${cordelia_internal_email},${hamlet_internal_email}`);
|
||||
assert.strictEqual(
|
||||
await common.get_text_from_selector(page, "title"),
|
||||
"Cordelia Lear, King Hamlet - Zulip Dev - Zulip",
|
||||
"Cordelia, Lear's daughter, King Hamlet - Zulip Dev - Zulip",
|
||||
"Didn't narrow to the private messages with cordelia and hamlet",
|
||||
);
|
||||
await page.click("#compose_close");
|
||||
|
@ -230,7 +230,7 @@ async function test_save_draft_by_reloading(page: Page): Promise<void> {
|
|||
page,
|
||||
".draft-row .message_header_private_message .stream_label",
|
||||
),
|
||||
"You and Cordelia Lear",
|
||||
"You and Cordelia, Lear's daughter",
|
||||
);
|
||||
assert.strictEqual(
|
||||
await common.get_text_from_selector(
|
||||
|
|
|
@ -68,7 +68,7 @@ async function test_edit_private_message(page: Page): Promise<void> {
|
|||
await common.wait_for_fully_processed_message(page, "test edited pm");
|
||||
|
||||
await common.check_messages_sent(page, "zhome", [
|
||||
["You and Cordelia Lear", ["test edited pm"]],
|
||||
["You and Cordelia, Lear's daughter", ["test edited pm"]],
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ async function expect_home(page: Page): Promise<void> {
|
|||
["Verona > test", ["verona test a", "verona test b"]],
|
||||
["Verona > other topic", ["verona other topic c"]],
|
||||
["Denmark > test", ["denmark message"]],
|
||||
["You and Cordelia Lear, King Hamlet", ["group pm a", "group pm b"]],
|
||||
["You and Cordelia Lear", ["pm c"]],
|
||||
["You and Cordelia, Lear's daughter, King Hamlet", ["group pm a", "group pm b"]],
|
||||
["You and Cordelia, Lear's daughter", ["pm c"]],
|
||||
["Verona > test", ["verona test d"]],
|
||||
["You and Cordelia Lear, King Hamlet", ["group pm d"]],
|
||||
["You and Cordelia Lear", ["pm e"]],
|
||||
["You and Cordelia, Lear's daughter, King Hamlet", ["group pm d"]],
|
||||
["You and Cordelia, Lear's daughter", ["pm e"]],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -62,14 +62,22 @@ async function expect_test_topic(page: Page): Promise<void> {
|
|||
async function expect_huddle(page: Page): Promise<void> {
|
||||
await page.waitForSelector("#zfilt", {visible: true});
|
||||
await common.check_messages_sent(page, "zfilt", [
|
||||
["You and Cordelia Lear, King Hamlet", ["group pm a", "group pm b", "group pm d"]],
|
||||
[
|
||||
"You and Cordelia, Lear's daughter, King Hamlet",
|
||||
["group pm a", "group pm b", "group pm d"],
|
||||
],
|
||||
]);
|
||||
assert.strictEqual(await page.title(), "Cordelia Lear, King Hamlet - Zulip Dev - Zulip");
|
||||
assert.strictEqual(
|
||||
await page.title(),
|
||||
"Cordelia, Lear's daughter, King Hamlet - Zulip Dev - Zulip",
|
||||
);
|
||||
}
|
||||
|
||||
async function expect_cordelia_private_narrow(page: Page): Promise<void> {
|
||||
await page.waitForSelector("#zfilt", {visible: true});
|
||||
await common.check_messages_sent(page, "zfilt", [["You and Cordelia Lear", ["pm c", "pm e"]]]);
|
||||
await common.check_messages_sent(page, "zfilt", [
|
||||
["You and Cordelia, Lear's daughter", ["pm c", "pm e"]],
|
||||
]);
|
||||
}
|
||||
|
||||
async function un_narrow(page: Page): Promise<void> {
|
||||
|
@ -108,9 +116,9 @@ async function test_navigations_from_home(page: Page): Promise<void> {
|
|||
|
||||
console.log("Narrowing by clicking group personal header");
|
||||
await page.evaluate(() =>
|
||||
$('*[title="Narrow to your private messages with Cordelia Lear, King Hamlet"]').trigger(
|
||||
"click",
|
||||
),
|
||||
$(
|
||||
'*[title="Narrow to your private messages with Cordelia, Lear\'s daughter, King Hamlet"]',
|
||||
).trigger("click"),
|
||||
);
|
||||
await expect_huddle(page);
|
||||
|
||||
|
@ -118,7 +126,9 @@ async function test_navigations_from_home(page: Page): Promise<void> {
|
|||
await expect_home(page);
|
||||
|
||||
await page.evaluate(() =>
|
||||
$('*[title="Narrow to your private messages with Cordelia Lear, King Hamlet"]').click(),
|
||||
$(
|
||||
'*[title="Narrow to your private messages with Cordelia, Lear\'s daughter, King Hamlet"]',
|
||||
).click(),
|
||||
);
|
||||
await un_narrow_by_clicking_org_icon(page);
|
||||
await expect_recent_topics(page);
|
||||
|
@ -190,7 +200,7 @@ async function search_tests(page: Page): Promise<void> {
|
|||
"Cordelia",
|
||||
"Private",
|
||||
expect_cordelia_private_narrow,
|
||||
"Cordelia Lear - Zulip Dev - Zulip",
|
||||
"Cordelia, Lear's daughter - Zulip Dev - Zulip",
|
||||
);
|
||||
|
||||
await search_and_check(
|
||||
|
@ -249,10 +259,10 @@ async function search_tests(page: Page): Promise<void> {
|
|||
async function expect_all_pm(page: Page): Promise<void> {
|
||||
await page.waitForSelector("#zfilt", {visible: true});
|
||||
await common.check_messages_sent(page, "zfilt", [
|
||||
["You and Cordelia Lear, King Hamlet", ["group pm a", "group pm b"]],
|
||||
["You and Cordelia Lear", ["pm c"]],
|
||||
["You and Cordelia Lear, King Hamlet", ["group pm d"]],
|
||||
["You and Cordelia Lear", ["pm e"]],
|
||||
["You and Cordelia, Lear's daughter, King Hamlet", ["group pm a", "group pm b"]],
|
||||
["You and Cordelia, Lear's daughter", ["pm c"]],
|
||||
["You and Cordelia, Lear's daughter, King Hamlet", ["group pm d"]],
|
||||
["You and Cordelia, Lear's daughter", ["pm e"]],
|
||||
]);
|
||||
assert.strictEqual(
|
||||
await common.get_text_from_selector(page, "#left_bar_compose_stream_button_big"),
|
||||
|
@ -391,7 +401,7 @@ async function test_users_search(page: Page): Promise<void> {
|
|||
}
|
||||
|
||||
await assert_in_list(page, "Desdemona");
|
||||
await assert_in_list(page, "Cordelia Lear");
|
||||
await assert_in_list(page, "Cordelia, Lear's daughter");
|
||||
await assert_in_list(page, "King Hamlet");
|
||||
await assert_in_list(page, "aaron");
|
||||
|
||||
|
@ -399,7 +409,7 @@ async function test_users_search(page: Page): Promise<void> {
|
|||
await page.click("#user_filter_icon");
|
||||
await page.waitForSelector("#user_presences .highlighted_user", {visible: true});
|
||||
await assert_selected(page, "Desdemona");
|
||||
await assert_not_selected(page, "Cordelia Lear");
|
||||
await assert_not_selected(page, "Cordelia, Lear's daughter");
|
||||
await assert_not_selected(page, "King Hamlet");
|
||||
await assert_not_selected(page, "aaron");
|
||||
|
||||
|
@ -407,7 +417,7 @@ async function test_users_search(page: Page): Promise<void> {
|
|||
// go down 2, up 3, then down 3
|
||||
// Desdemona
|
||||
// aaron
|
||||
// Cordelia Lear
|
||||
// Cordelia, Lear's daughter
|
||||
// Iago
|
||||
await arrow(page, "Down");
|
||||
await arrow(page, "Down");
|
||||
|
@ -426,7 +436,7 @@ async function test_users_search(page: Page): Promise<void> {
|
|||
await assert_not_selected(page, "aaron");
|
||||
await assert_not_selected(page, "Desdemona");
|
||||
|
||||
// arrow up and press Enter. We should be taken to pms with Cordelia Lear
|
||||
// arrow up and press Enter. We should be taken to pms with Cordelia, Lear's daughter
|
||||
await arrow(page, "Up");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect_cordelia_private_narrow(page);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
"uid=cordelia,ou=users,dc=zulip,dc=com": {
|
||||
"objectClass": ["user"],
|
||||
"cn": ["Cordelia Lear"],
|
||||
"cn": ["Cordelia, Lear's daughter"],
|
||||
"uid": ["cordelia"],
|
||||
"mail": ["cordelia@zulip.com"],
|
||||
"sn": ["Cordelia"]
|
||||
|
|
|
@ -452,7 +452,7 @@ class TestMissedMessages(ZulipTestCase):
|
|||
self.example_user("othello"), "Denmark", "@**King Hamlet**"
|
||||
)
|
||||
verify_body_include = [
|
||||
"Cordelia Lear: 0 1 2 Othello, the Moor of Venice: @**King Hamlet** -- ",
|
||||
"Cordelia, Lear's daughter: 0 1 2 Othello, the Moor of Venice: @**King Hamlet** -- ",
|
||||
"You are receiving this because you were mentioned in Zulip Dev.",
|
||||
]
|
||||
email_subject = "#Denmark > test"
|
||||
|
@ -583,7 +583,9 @@ class TestMissedMessages(ZulipTestCase):
|
|||
)
|
||||
|
||||
verify_body_include = ["Othello, the Moor of Venice: Group personal message! -- Reply"]
|
||||
email_subject = "Group PMs with Cordelia Lear, Iago, and Othello, the Moor of Venice"
|
||||
email_subject = (
|
||||
"Group PMs with Cordelia, Lear's daughter, Iago, and Othello, the Moor of Venice"
|
||||
)
|
||||
self._test_cases(msg_id, verify_body_include, email_subject, send_as_user)
|
||||
|
||||
def _extra_context_in_huddle_missed_stream_messages_many_others(
|
||||
|
@ -601,7 +603,7 @@ class TestMissedMessages(ZulipTestCase):
|
|||
)
|
||||
|
||||
verify_body_include = ["Othello, the Moor of Venice: Group personal message! -- Reply"]
|
||||
email_subject = "Group PMs with Cordelia Lear, Iago, and 2 others"
|
||||
email_subject = "Group PMs with Cordelia, Lear's daughter, Iago, and 2 others"
|
||||
self._test_cases(msg_id, verify_body_include, email_subject, send_as_user)
|
||||
|
||||
def _deleted_message_in_missed_stream_messages(self, send_as_user: bool) -> None:
|
||||
|
|
|
@ -949,7 +949,7 @@ class ImportExportTest(ZulipTestCase):
|
|||
|
||||
assert_realm_values(get_realm_audit_log_event_type)
|
||||
|
||||
cordelia_full_name = "Cordelia Lear"
|
||||
cordelia_full_name = "Cordelia, Lear's daughter"
|
||||
hamlet_full_name = "King Hamlet"
|
||||
othello_full_name = "Othello, the Moor of Venice"
|
||||
|
||||
|
|
|
@ -229,10 +229,10 @@ class MarkdownMiscTest(ZulipTestCase):
|
|||
fred4 = make_user("fred4@example.com", "Fred Flintstone")
|
||||
|
||||
lst = get_possible_mentions_info(
|
||||
realm.id, {"Fred Flintstone", "cordelia LEAR", "Not A User"}
|
||||
realm.id, {"Fred Flintstone", "Cordelia, LEAR's daughter", "Not A User"}
|
||||
)
|
||||
set_of_names = set(map(lambda x: x["full_name"].lower(), lst))
|
||||
self.assertEqual(set_of_names, {"fred flintstone", "cordelia lear"})
|
||||
self.assertEqual(set_of_names, {"fred flintstone", "cordelia, lear's daughter"})
|
||||
|
||||
by_id = {row["id"]: row for row in lst}
|
||||
self.assertEqual(
|
||||
|
@ -256,7 +256,7 @@ class MarkdownMiscTest(ZulipTestCase):
|
|||
realm = get_realm("zulip")
|
||||
hamlet = self.example_user("hamlet")
|
||||
cordelia = self.example_user("cordelia")
|
||||
content = "@**King Hamlet** @**Cordelia lear**"
|
||||
content = "@**King Hamlet** @**Cordelia, lear's daughter**"
|
||||
mention_data = MentionData(realm.id, content)
|
||||
self.assertEqual(mention_data.get_user_ids(), {hamlet.id, cordelia.id})
|
||||
self.assertEqual(
|
||||
|
@ -273,7 +273,7 @@ class MarkdownMiscTest(ZulipTestCase):
|
|||
self.assertEqual(user["email"], hamlet.email)
|
||||
|
||||
self.assertFalse(mention_data.message_has_wildcards())
|
||||
content = "@**King Hamlet** @**Cordelia lear** @**all**"
|
||||
content = "@**King Hamlet** @**Cordelia, lear's daughter** @**all**"
|
||||
mention_data = MentionData(realm.id, content)
|
||||
self.assertTrue(mention_data.message_has_wildcards())
|
||||
|
||||
|
@ -1946,8 +1946,8 @@ class MarkdownTest(ZulipTestCase):
|
|||
assert_mentions("smush@**steve**smush", set())
|
||||
|
||||
assert_mentions(
|
||||
f"Hello @**King Hamlet**, @**|{aaron.id}** and @**Cordelia Lear**\n@**Foo van Barson|1234** @**all**",
|
||||
{"King Hamlet", f"|{aaron.id}", "Cordelia Lear", "Foo van Barson|1234"},
|
||||
f"Hello @**King Hamlet**, @**|{aaron.id}** and @**Cordelia, Lear's daughter**\n@**Foo van Barson|1234** @**all**",
|
||||
{"King Hamlet", f"|{aaron.id}", "Cordelia, Lear's daughter", "Foo van Barson|1234"},
|
||||
True,
|
||||
)
|
||||
|
||||
|
@ -1957,7 +1957,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
cordelia = self.example_user("cordelia")
|
||||
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))
|
||||
|
||||
content = "@**King Hamlet** and @**Cordelia Lear**, check this out"
|
||||
content = "@**King Hamlet** and @**Cordelia, Lear's daughter**, check this out"
|
||||
|
||||
self.assertEqual(
|
||||
render_markdown(msg, content),
|
||||
|
@ -1965,7 +1965,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
'<span class="user-mention" '
|
||||
f'data-user-id="{hamlet.id}">@King Hamlet</span> and '
|
||||
'<span class="user-mention" '
|
||||
f'data-user-id="{cordelia.id}">@Cordelia Lear</span>, '
|
||||
f'data-user-id="{cordelia.id}">@Cordelia, Lear\'s daughter</span>, '
|
||||
"check this out</p>",
|
||||
)
|
||||
self.assertEqual(msg.mentions_user_ids, {hamlet.id, cordelia.id})
|
||||
|
@ -1976,7 +1976,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
cordelia = self.example_user("cordelia")
|
||||
msg = Message(sender=othello, sending_client=get_client("test"))
|
||||
|
||||
content = "> @**King Hamlet** and @**Othello, the Moor of Venice**\n\n @**King Hamlet** and @**Cordelia Lear**"
|
||||
content = "> @**King Hamlet** and @**Othello, the Moor of Venice**\n\n @**King Hamlet** and @**Cordelia, Lear's daughter**"
|
||||
self.assertEqual(
|
||||
render_markdown(msg, content),
|
||||
"<blockquote>\n<p>"
|
||||
|
@ -1987,7 +1987,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
"<p>"
|
||||
f'<span class="user-mention" data-user-id="{hamlet.id}">@King Hamlet</span>'
|
||||
" and "
|
||||
f'<span class="user-mention" data-user-id="{cordelia.id}">@Cordelia Lear</span>'
|
||||
f'<span class="user-mention" data-user-id="{cordelia.id}">@Cordelia, Lear\'s daughter</span>'
|
||||
"</p>",
|
||||
)
|
||||
self.assertEqual(msg.mentions_user_ids, {hamlet.id, cordelia.id})
|
||||
|
@ -2028,9 +2028,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
cordelia = self.example_user("cordelia")
|
||||
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))
|
||||
|
||||
content = (
|
||||
f"@**Mark Twin|{twin1.id}**, @**Mark Twin|{twin2.id}** and @**Cordelia Lear**, hi."
|
||||
)
|
||||
content = f"@**Mark Twin|{twin1.id}**, @**Mark Twin|{twin2.id}** and @**Cordelia, Lear's daughter**, hi."
|
||||
|
||||
self.assertEqual(
|
||||
render_markdown(msg, content),
|
||||
|
@ -2040,7 +2038,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
'<span class="user-mention" '
|
||||
f'data-user-id="{twin2.id}">@Mark Twin</span> and '
|
||||
'<span class="user-mention" '
|
||||
f'data-user-id="{cordelia.id}">@Cordelia Lear</span>, '
|
||||
f'data-user-id="{cordelia.id}">@Cordelia, Lear\'s daughter</span>, '
|
||||
"hi.</p>",
|
||||
)
|
||||
self.assertEqual(msg.mentions_user_ids, {twin1.id, twin2.id, cordelia.id})
|
||||
|
@ -2180,7 +2178,7 @@ class MarkdownTest(ZulipTestCase):
|
|||
assert_mentions("smush@*steve*smush", set())
|
||||
|
||||
assert_mentions(
|
||||
"@*support* Hello @**King Hamlet** and @**Cordelia Lear**\n"
|
||||
"@*support* Hello @**King Hamlet** and @**Cordelia, Lear's daughter**\n"
|
||||
"@**Foo van Barson** @**all**",
|
||||
{"support"},
|
||||
)
|
||||
|
|
|
@ -439,7 +439,9 @@ class EditMessageTest(ZulipTestCase):
|
|||
self.subscribe(hamlet, "Scotland")
|
||||
self.subscribe(cordelia, "Scotland")
|
||||
|
||||
msg_id = self.send_stream_message(hamlet, "Scotland", content="@**Cordelia Lear**")
|
||||
msg_id = self.send_stream_message(
|
||||
hamlet, "Scotland", content="@**Cordelia, Lear's daughter**"
|
||||
)
|
||||
|
||||
user_info = get_user_info_for_message_updates(msg_id)
|
||||
message_user_ids = user_info["message_user_ids"]
|
||||
|
|
|
@ -40,7 +40,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
|
||||
self._assert_update_does_not_notify_anybody(
|
||||
message_id=message_id,
|
||||
content="now we mention @**Cordelia Lear**",
|
||||
content="now we mention @**Cordelia, Lear's daughter**",
|
||||
)
|
||||
|
||||
def _login_and_send_original_stream_message(
|
||||
|
@ -177,7 +177,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
|
||||
def test_updates_with_stream_mention(self) -> None:
|
||||
original_content = "no mention"
|
||||
updated_content = "now we mention @**Cordelia Lear**"
|
||||
updated_content = "now we mention @**Cordelia, Lear's daughter**"
|
||||
notification_message_data = self._send_and_update_message(original_content, updated_content)
|
||||
|
||||
message_id = notification_message_data["message_id"]
|
||||
|
@ -217,8 +217,8 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
self.assertEqual(email_event["trigger"], "mentioned")
|
||||
|
||||
def test_second_mention_is_ignored(self) -> None:
|
||||
original_content = "hello @**Cordelia Lear**"
|
||||
updated_content = "re-mention @**Cordelia Lear**"
|
||||
original_content = "hello @**Cordelia, Lear's daughter**"
|
||||
updated_content = "re-mention @**Cordelia, Lear's daughter**"
|
||||
self._send_and_update_message(original_content, updated_content, expect_short_circuit=True)
|
||||
|
||||
def _turn_on_stream_push_for_cordelia(self) -> None:
|
||||
|
@ -305,7 +305,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
# Simulate Cordelia is FULLY present, not just in term of
|
||||
# browser activity, but also in terms of her client descriptors.
|
||||
original_content = "no mention"
|
||||
updated_content = "newly mention @**Cordelia Lear**"
|
||||
updated_content = "newly mention @**Cordelia, Lear's daughter**"
|
||||
notification_message_data = self._send_and_update_message(
|
||||
original_content,
|
||||
updated_content,
|
||||
|
@ -385,7 +385,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
# but they don't have UserPresence rows, so we will still
|
||||
# send offline notifications.
|
||||
original_content = "no mention"
|
||||
updated_content = "now we mention @**Cordelia Lear**"
|
||||
updated_content = "now we mention @**Cordelia, Lear's daughter**"
|
||||
notification_message_data = self._send_and_update_message(
|
||||
original_content,
|
||||
updated_content,
|
||||
|
@ -453,7 +453,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
# If there was a previous wildcard mention delivered to the
|
||||
# user (because wildcard_mention_notify=True), we don't notify
|
||||
original_content = "Mention @**all**"
|
||||
updated_content = "now we mention @**Cordelia Lear**"
|
||||
updated_content = "now we mention @**Cordelia, Lear's daughter**"
|
||||
self._send_and_update_message(
|
||||
original_content, updated_content, expect_short_circuit=True, connected_to_zulip=True
|
||||
)
|
||||
|
@ -470,7 +470,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
cordelia.save()
|
||||
|
||||
original_content = "Mention @**all**"
|
||||
updated_content = "now we mention @**Cordelia Lear**"
|
||||
updated_content = "now we mention @**Cordelia, Lear's daughter**"
|
||||
self._send_and_update_message(
|
||||
original_content, updated_content, expect_short_circuit=True, connected_to_zulip=True
|
||||
)
|
||||
|
@ -481,7 +481,7 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
# Simulate Cordelia is FULLY present, not just in term of
|
||||
# browser activity, but also in terms of her client descriptors.
|
||||
original_content = "no mention"
|
||||
updated_content = "now we mention @**Cordelia Lear**"
|
||||
updated_content = "now we mention @**Cordelia, Lear's daughter**"
|
||||
notification_message_data = self._send_and_update_message(
|
||||
original_content,
|
||||
updated_content,
|
||||
|
|
|
@ -1642,7 +1642,7 @@ class StreamMessagesTest(ZulipTestCase):
|
|||
).delete()
|
||||
|
||||
def mention_cordelia() -> Set[int]:
|
||||
content = "test @**Cordelia Lear** rules"
|
||||
content = "test @**Cordelia, Lear's daughter** rules"
|
||||
|
||||
user_ids = self._send_stream_message(
|
||||
user=hamlet,
|
||||
|
|
|
@ -249,5 +249,6 @@ class TestNotifyNewUser(ZulipTestCase):
|
|||
actual_stream = Stream.objects.get(id=message.recipient.type_id)
|
||||
self.assertEqual(actual_stream.name, Realm.INITIAL_PRIVATE_STREAM_NAME)
|
||||
self.assertIn(
|
||||
f"@_**Cordelia Lear|{new_user.id}** just signed up for Zulip.", message.content
|
||||
f"@_**Cordelia, Lear's daughter|{new_user.id}** just signed up for Zulip.",
|
||||
message.content,
|
||||
)
|
||||
|
|
|
@ -1490,7 +1490,7 @@ class TestGetAPNsPayload(PushNotificationTest):
|
|||
payload = get_message_payload_apns(user_profile, message)
|
||||
expected = {
|
||||
"alert": {
|
||||
"title": "Cordelia Lear, King Hamlet, Othello, the Moor of Venice",
|
||||
"title": "Cordelia, Lear's daughter, King Hamlet, Othello, the Moor of Venice",
|
||||
"subtitle": "King Hamlet:",
|
||||
"body": message.content,
|
||||
},
|
||||
|
@ -1622,7 +1622,7 @@ class TestGetAPNsPayload(PushNotificationTest):
|
|||
payload = get_message_payload_apns(user_profile, message)
|
||||
expected = {
|
||||
"alert": {
|
||||
"title": "Cordelia Lear, King Hamlet, Othello, the Moor of Venice",
|
||||
"title": "Cordelia, Lear's daughter, King Hamlet, Othello, the Moor of Venice",
|
||||
"subtitle": "King Hamlet:",
|
||||
"body": "***REDACTED***",
|
||||
},
|
||||
|
@ -2298,8 +2298,8 @@ class TestPushNotificationsContent(ZulipTestCase):
|
|||
},
|
||||
{
|
||||
"name": "mentions",
|
||||
"rendered_content": f'<p>Mentioning <span class="user-mention" data-user-id="{cordelia.id}">@Cordelia Lear</span>.</p>',
|
||||
"expected_output": "Mentioning @Cordelia Lear.",
|
||||
"rendered_content": f'<p>Mentioning <span class="user-mention" data-user-id="{cordelia.id}">@Cordelia, Lear\'s daughter</span>.</p>',
|
||||
"expected_output": "Mentioning @Cordelia, Lear's daughter.",
|
||||
},
|
||||
{
|
||||
"name": "stream_names",
|
||||
|
|
|
@ -671,7 +671,7 @@ class SoftDeactivationMessageTest(ZulipTestCase):
|
|||
# anyone is mentioned but the user.
|
||||
general_user_msg_count = len(get_user_messages(cordelia))
|
||||
soft_deactivated_user_msg_count = len(get_user_messages(long_term_idle_user))
|
||||
message = "Test @**Cordelia Lear** mention"
|
||||
message = "Test @**Cordelia, Lear's daughter** mention"
|
||||
send_stream_message(message)
|
||||
assert_last_um_content(long_term_idle_user, message, negate=True)
|
||||
assert_um_count(long_term_idle_user, soft_deactivated_user_msg_count)
|
||||
|
|
|
@ -1221,8 +1221,8 @@ class UserProfileTest(ZulipTestCase):
|
|||
self.assertEqual(len(events), 0)
|
||||
|
||||
# We verify that cordelia and iago match, but hamlet has the defaults.
|
||||
self.assertEqual(iago.full_name, "Cordelia Lear")
|
||||
self.assertEqual(cordelia.full_name, "Cordelia Lear")
|
||||
self.assertEqual(iago.full_name, "Cordelia, Lear's daughter")
|
||||
self.assertEqual(cordelia.full_name, "Cordelia, Lear's daughter")
|
||||
self.assertEqual(hamlet.full_name, "King Hamlet")
|
||||
|
||||
self.assertEqual(iago.default_language, "de")
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"assignee":{
|
||||
"type":"admin",
|
||||
"id":"1957471",
|
||||
"name":"Cordelia Lear",
|
||||
"name":"Cordelia, Lear's daughter",
|
||||
"email":"cordelia@zulip.com"
|
||||
},
|
||||
"conversation_message":{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"assignee": {
|
||||
"type": "admin",
|
||||
"id": "1957471",
|
||||
"name": "Cordelia Lear",
|
||||
"name": "Cordelia, Lear's daughter",
|
||||
"email": "cordelia@zulip.com"
|
||||
},
|
||||
"conversation_message": {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"type": "lead",
|
||||
"id": "5c96b58c27e3772c4751b2a3",
|
||||
"user_id": "ced6189f-e3b0-40b6-ab3a-9fdb27f4b3b0",
|
||||
"name": "Cordelia Lear",
|
||||
"name": "Cordelia, Lear's daughter",
|
||||
"email": "eg3800@mun.ca",
|
||||
"do_not_track": null
|
||||
},
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"assignee":{
|
||||
"type": "admin",
|
||||
"id": "1957471",
|
||||
"name": "Cordelia Lear",
|
||||
"name": "Cordelia, Lear's daughter",
|
||||
"email": "cordelia@zulip.com"
|
||||
},
|
||||
"conversation_message":{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"assignee": {
|
||||
"type": "admin",
|
||||
"id": "1957471",
|
||||
"name": "Cordelia Lear",
|
||||
"name": "Cordelia, Lear's daughter",
|
||||
"email": "cordelia@zulip.com"
|
||||
},
|
||||
"conversation_message": {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"assignee": {
|
||||
"type": "admin",
|
||||
"id": "1957471",
|
||||
"name": "Cordelia Lear",
|
||||
"name": "Cordelia, Lear's daughter",
|
||||
"email": "cordelia@zulip.com"
|
||||
},
|
||||
"conversation_message": {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"assignee": {
|
||||
"type": "admin",
|
||||
"id": "1957471",
|
||||
"name": "Cordelia Lear",
|
||||
"name": "Cordelia, Lear's daughter",
|
||||
"email": "cordelia@zulip.com"
|
||||
},
|
||||
"conversation_message": {
|
||||
|
|
|
@ -93,7 +93,7 @@ Contact signed up:
|
|||
)
|
||||
|
||||
def test_conversation_admin_opened(self) -> None:
|
||||
expected_topic = "Lead: Cordelia Lear"
|
||||
expected_topic = "Lead: Cordelia, Lear's daughter"
|
||||
expected_message = "Eeshan Garg opened the conversation."
|
||||
self.check_webhook(
|
||||
"conversation_admin_opened",
|
||||
|
@ -103,7 +103,7 @@ Contact signed up:
|
|||
|
||||
def test_conversation_admin_closed(self) -> None:
|
||||
expected_topic = "Lead: Eeshan Garg"
|
||||
expected_message = "Cordelia Lear closed the conversation."
|
||||
expected_message = "Cordelia, Lear's daughter closed the conversation."
|
||||
self.check_webhook(
|
||||
"conversation_admin_closed",
|
||||
expected_topic,
|
||||
|
@ -112,7 +112,7 @@ Contact signed up:
|
|||
|
||||
def test_conversation_admin_snoozed(self) -> None:
|
||||
expected_topic = "Lead: Eeshan Garg"
|
||||
expected_message = "Cordelia Lear snoozed the conversation."
|
||||
expected_message = "Cordelia, Lear's daughter snoozed the conversation."
|
||||
self.check_webhook(
|
||||
"conversation_admin_snoozed",
|
||||
expected_topic,
|
||||
|
@ -121,7 +121,7 @@ Contact signed up:
|
|||
|
||||
def test_conversation_admin_unsnoozed(self) -> None:
|
||||
expected_topic = "Lead: Eeshan Garg"
|
||||
expected_message = "Cordelia Lear unsnoozed the conversation."
|
||||
expected_message = "Cordelia, Lear's daughter unsnoozed the conversation."
|
||||
self.check_webhook(
|
||||
"conversation_admin_unsnoozed",
|
||||
expected_topic,
|
||||
|
@ -131,7 +131,7 @@ Contact signed up:
|
|||
def test_conversation_admin_replied(self) -> None:
|
||||
expected_topic = "Lead: Eeshan Garg"
|
||||
expected_message = """
|
||||
Cordelia Lear replied to the conversation:
|
||||
Cordelia, Lear's daughter replied to the conversation:
|
||||
|
||||
``` quote
|
||||
Hey Eeshan! How can I help?
|
||||
|
@ -146,7 +146,7 @@ Hey Eeshan! How can I help?
|
|||
def test_conversation_admin_noted(self) -> None:
|
||||
expected_topic = "Lead: Eeshan Garg"
|
||||
expected_message = """
|
||||
Cordelia Lear added a note to the conversation:
|
||||
Cordelia, Lear's daughter added a note to the conversation:
|
||||
|
||||
``` quote
|
||||
Talk to Tim about this user's query.
|
||||
|
@ -161,7 +161,7 @@ Talk to Tim about this user's query.
|
|||
def test_conversation_admin_single_created(self) -> None:
|
||||
expected_topic = "Lead: Eeshan Garg"
|
||||
expected_message = """
|
||||
Cordelia Lear initiated a conversation:
|
||||
Cordelia, Lear's daughter initiated a conversation:
|
||||
|
||||
``` quote
|
||||
Hi Eeshan, What's up
|
||||
|
|
|
@ -344,7 +344,7 @@ class Command(BaseCommand):
|
|||
("Othello, the Moor of Venice", "othello@zulip.com"),
|
||||
("Iago", "iago@zulip.com"),
|
||||
("Prospero from The Tempest", "prospero@zulip.com"),
|
||||
("Cordelia Lear", "cordelia@zulip.com"),
|
||||
("Cordelia, Lear's daughter", "cordelia@zulip.com"),
|
||||
("King Hamlet", "hamlet@zulip.com"),
|
||||
("aaron", "AARON@zulip.com"),
|
||||
("Polonius", "polonius@zulip.com"),
|
||||
|
@ -746,7 +746,7 @@ class Command(BaseCommand):
|
|||
|
||||
testsuite_lear_users = [
|
||||
("King Lear", "king@lear.org"),
|
||||
("Cordelia Lear", "cordelia@zulip.com"),
|
||||
("Cordelia, Lear's daughter", "cordelia@zulip.com"),
|
||||
]
|
||||
create_users(lear_realm, testsuite_lear_users, tos_version=settings.TOS_VERSION)
|
||||
|
||||
|
|
Loading…
Reference in New Issue