mirror of https://github.com/zulip/zulip.git
tests: Fix unused `message_id` parameter in tests.
Various backend tests use the `PATCH /messages/{msg_id}` endpoint. For that endpoint, the message ID is encoded in the URL path and ignored if provided as a parameter in the the query. Verified that the tests were providing the same message ID to both the path and then removed the ignored parameter in the query.
This commit is contained in:
parent
1ac2eaa7f9
commit
7a7f3337c1
|
@ -217,7 +217,6 @@ class AlertWordTests(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(original_message.id),
|
"/json/messages/" + str(original_message.id),
|
||||||
{
|
{
|
||||||
"message_id": original_message.id,
|
|
||||||
"content": "new ALERT for you",
|
"content": "new ALERT for you",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -230,7 +229,6 @@ class AlertWordTests(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(original_message.id),
|
"/json/messages/" + str(original_message.id),
|
||||||
{
|
{
|
||||||
"message_id": original_message.id,
|
|
||||||
"content": "sorry false alarm",
|
"content": "sorry false alarm",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -773,9 +773,7 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
|
|
||||||
hamlet = self.example_user("hamlet")
|
hamlet = self.example_user("hamlet")
|
||||||
self.login("othello")
|
self.login("othello")
|
||||||
result = self.client_patch(
|
result = self.client_patch("/json/messages/" + str(msg_id), {"content": " "})
|
||||||
"/json/messages/" + str(msg_id), {"message_id": msg_id, "content": " "}
|
|
||||||
)
|
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
||||||
self.assert_length(mail.outbox, 0)
|
self.assert_length(mail.outbox, 0)
|
||||||
|
@ -789,9 +787,7 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
|
|
||||||
hamlet = self.example_user("hamlet")
|
hamlet = self.example_user("hamlet")
|
||||||
self.login("othello")
|
self.login("othello")
|
||||||
result = self.client_patch(
|
result = self.client_patch("/json/messages/" + str(msg_id), {"content": " "})
|
||||||
"/json/messages/" + str(msg_id), {"message_id": msg_id, "content": " "}
|
|
||||||
)
|
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
||||||
self.assert_length(mail.outbox, 0)
|
self.assert_length(mail.outbox, 0)
|
||||||
|
@ -809,9 +805,7 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
hamlet = self.example_user("hamlet")
|
hamlet = self.example_user("hamlet")
|
||||||
iago = self.example_user("iago")
|
iago = self.example_user("iago")
|
||||||
self.login("othello")
|
self.login("othello")
|
||||||
result = self.client_patch(
|
result = self.client_patch("/json/messages/" + str(msg_id), {"content": " "})
|
||||||
"/json/messages/" + str(msg_id), {"message_id": msg_id, "content": " "}
|
|
||||||
)
|
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
||||||
self.assert_length(mail.outbox, 0)
|
self.assert_length(mail.outbox, 0)
|
||||||
|
|
|
@ -393,7 +393,6 @@ class PreviewTestCase(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(msg_id),
|
"/json/messages/" + str(msg_id),
|
||||||
{
|
{
|
||||||
"message_id": msg_id,
|
|
||||||
"content": url,
|
"content": url,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -515,7 +514,6 @@ class PreviewTestCase(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(msg_id),
|
"/json/messages/" + str(msg_id),
|
||||||
{
|
{
|
||||||
"message_id": msg_id,
|
|
||||||
"content": edited_url,
|
"content": edited_url,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -2358,7 +2358,6 @@ class MarkdownTest(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(msg_id),
|
"/json/messages/" + str(msg_id),
|
||||||
{
|
{
|
||||||
"message_id": msg_id,
|
|
||||||
"content": content,
|
"content": content,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -862,7 +862,7 @@ class EditMessageTest(EditMessageTestCase):
|
||||||
) -> None:
|
) -> None:
|
||||||
new_topic = "topic" + unique_str
|
new_topic = "topic" + unique_str
|
||||||
new_content = "content" + unique_str
|
new_content = "content" + unique_str
|
||||||
params_dict = {"message_id": id_, "topic": new_topic}
|
params_dict = {"topic": new_topic}
|
||||||
if not topic_only:
|
if not topic_only:
|
||||||
params_dict["content"] = new_content
|
params_dict["content"] = new_content
|
||||||
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
||||||
|
@ -880,7 +880,7 @@ class EditMessageTest(EditMessageTestCase):
|
||||||
old_content = message.content
|
old_content = message.content
|
||||||
new_topic = "topic" + unique_str
|
new_topic = "topic" + unique_str
|
||||||
new_content = "content" + unique_str
|
new_content = "content" + unique_str
|
||||||
params_dict = {"message_id": id_, "topic": new_topic}
|
params_dict = {"topic": new_topic}
|
||||||
if not topic_only:
|
if not topic_only:
|
||||||
params_dict["content"] = new_content
|
params_dict["content"] = new_content
|
||||||
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
||||||
|
@ -948,7 +948,7 @@ class EditMessageTest(EditMessageTestCase):
|
||||||
def do_edit_message_assert_success(id_: int, unique_str: str, acting_user: str) -> None:
|
def do_edit_message_assert_success(id_: int, unique_str: str, acting_user: str) -> None:
|
||||||
self.login(acting_user)
|
self.login(acting_user)
|
||||||
new_topic = "topic" + unique_str
|
new_topic = "topic" + unique_str
|
||||||
params_dict = {"message_id": id_, "topic": new_topic}
|
params_dict = {"topic": new_topic}
|
||||||
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
self.check_topic(id_, topic_name=new_topic)
|
self.check_topic(id_, topic_name=new_topic)
|
||||||
|
@ -961,7 +961,7 @@ class EditMessageTest(EditMessageTestCase):
|
||||||
old_topic = message.topic_name()
|
old_topic = message.topic_name()
|
||||||
old_content = message.content
|
old_content = message.content
|
||||||
new_topic = "topic" + unique_str
|
new_topic = "topic" + unique_str
|
||||||
params_dict = {"message_id": id_, "topic": new_topic}
|
params_dict = {"topic": new_topic}
|
||||||
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
||||||
message = Message.objects.get(id=id_)
|
message = Message.objects.get(id=id_)
|
||||||
self.assert_json_error(result, error)
|
self.assert_json_error(result, error)
|
||||||
|
|
|
@ -15,7 +15,6 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
||||||
url = "/json/messages/" + str(message_id)
|
url = "/json/messages/" + str(message_id)
|
||||||
|
|
||||||
request = dict(
|
request = dict(
|
||||||
message_id=message_id,
|
|
||||||
content=content,
|
content=content,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
||||||
url = "/json/messages/" + str(message_id)
|
url = "/json/messages/" + str(message_id)
|
||||||
|
|
||||||
request = dict(
|
request = dict(
|
||||||
message_id=message_id,
|
|
||||||
content=content,
|
content=content,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,6 @@ class MutedUsersTests(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(message_id),
|
"/json/messages/" + str(message_id),
|
||||||
dict(
|
dict(
|
||||||
message_id=message_id,
|
|
||||||
content="@**King Hamlet**",
|
content="@**King Hamlet**",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -359,7 +358,6 @@ class MutedUsersTests(ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(message_id),
|
"/json/messages/" + str(message_id),
|
||||||
dict(
|
dict(
|
||||||
message_id=message_id,
|
|
||||||
content="@**King Hamlet**",
|
content="@**King Hamlet**",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -472,7 +472,6 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(msg_id),
|
"/json/messages/" + str(msg_id),
|
||||||
{
|
{
|
||||||
"message_id": msg_id,
|
|
||||||
"content": new_body,
|
"content": new_body,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -492,7 +491,6 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
||||||
result = self.client_patch(
|
result = self.client_patch(
|
||||||
"/json/messages/" + str(msg_id),
|
"/json/messages/" + str(msg_id),
|
||||||
{
|
{
|
||||||
"message_id": msg_id,
|
|
||||||
"content": new_body,
|
"content": new_body,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue