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(
|
||||
"/json/messages/" + str(original_message.id),
|
||||
{
|
||||
"message_id": original_message.id,
|
||||
"content": "new ALERT for you",
|
||||
},
|
||||
)
|
||||
|
@ -230,7 +229,6 @@ class AlertWordTests(ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(original_message.id),
|
||||
{
|
||||
"message_id": original_message.id,
|
||||
"content": "sorry false alarm",
|
||||
},
|
||||
)
|
||||
|
|
|
@ -773,9 +773,7 @@ class TestMissedMessages(ZulipTestCase):
|
|||
|
||||
hamlet = self.example_user("hamlet")
|
||||
self.login("othello")
|
||||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id), {"message_id": msg_id, "content": " "}
|
||||
)
|
||||
result = self.client_patch("/json/messages/" + str(msg_id), {"content": " "})
|
||||
self.assert_json_success(result)
|
||||
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
||||
self.assert_length(mail.outbox, 0)
|
||||
|
@ -789,9 +787,7 @@ class TestMissedMessages(ZulipTestCase):
|
|||
|
||||
hamlet = self.example_user("hamlet")
|
||||
self.login("othello")
|
||||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id), {"message_id": msg_id, "content": " "}
|
||||
)
|
||||
result = self.client_patch("/json/messages/" + str(msg_id), {"content": " "})
|
||||
self.assert_json_success(result)
|
||||
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
||||
self.assert_length(mail.outbox, 0)
|
||||
|
@ -809,9 +805,7 @@ class TestMissedMessages(ZulipTestCase):
|
|||
hamlet = self.example_user("hamlet")
|
||||
iago = self.example_user("iago")
|
||||
self.login("othello")
|
||||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id), {"message_id": msg_id, "content": " "}
|
||||
)
|
||||
result = self.client_patch("/json/messages/" + str(msg_id), {"content": " "})
|
||||
self.assert_json_success(result)
|
||||
handle_missedmessage_emails(hamlet.id, [{"message_id": msg_id}])
|
||||
self.assert_length(mail.outbox, 0)
|
||||
|
|
|
@ -393,7 +393,6 @@ class PreviewTestCase(ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id),
|
||||
{
|
||||
"message_id": msg_id,
|
||||
"content": url,
|
||||
},
|
||||
)
|
||||
|
@ -515,7 +514,6 @@ class PreviewTestCase(ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id),
|
||||
{
|
||||
"message_id": msg_id,
|
||||
"content": edited_url,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -2358,7 +2358,6 @@ class MarkdownTest(ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id),
|
||||
{
|
||||
"message_id": msg_id,
|
||||
"content": content,
|
||||
},
|
||||
)
|
||||
|
|
|
@ -862,7 +862,7 @@ class EditMessageTest(EditMessageTestCase):
|
|||
) -> None:
|
||||
new_topic = "topic" + unique_str
|
||||
new_content = "content" + unique_str
|
||||
params_dict = {"message_id": id_, "topic": new_topic}
|
||||
params_dict = {"topic": new_topic}
|
||||
if not topic_only:
|
||||
params_dict["content"] = new_content
|
||||
result = self.client_patch(f"/json/messages/{id_}", params_dict)
|
||||
|
@ -880,7 +880,7 @@ class EditMessageTest(EditMessageTestCase):
|
|||
old_content = message.content
|
||||
new_topic = "topic" + unique_str
|
||||
new_content = "content" + unique_str
|
||||
params_dict = {"message_id": id_, "topic": new_topic}
|
||||
params_dict = {"topic": new_topic}
|
||||
if not topic_only:
|
||||
params_dict["content"] = new_content
|
||||
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:
|
||||
self.login(acting_user)
|
||||
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)
|
||||
self.assert_json_success(result)
|
||||
self.check_topic(id_, topic_name=new_topic)
|
||||
|
@ -961,7 +961,7 @@ class EditMessageTest(EditMessageTestCase):
|
|||
old_topic = message.topic_name()
|
||||
old_content = message.content
|
||||
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)
|
||||
message = Message.objects.get(id=id_)
|
||||
self.assert_json_error(result, error)
|
||||
|
|
|
@ -15,7 +15,6 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
url = "/json/messages/" + str(message_id)
|
||||
|
||||
request = dict(
|
||||
message_id=message_id,
|
||||
content=content,
|
||||
)
|
||||
|
||||
|
@ -93,7 +92,6 @@ class EditMessageSideEffectsTest(ZulipTestCase):
|
|||
url = "/json/messages/" + str(message_id)
|
||||
|
||||
request = dict(
|
||||
message_id=message_id,
|
||||
content=content,
|
||||
)
|
||||
|
||||
|
|
|
@ -335,7 +335,6 @@ class MutedUsersTests(ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(message_id),
|
||||
dict(
|
||||
message_id=message_id,
|
||||
content="@**King Hamlet**",
|
||||
),
|
||||
)
|
||||
|
@ -359,7 +358,6 @@ class MutedUsersTests(ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(message_id),
|
||||
dict(
|
||||
message_id=message_id,
|
||||
content="@**King Hamlet**",
|
||||
),
|
||||
)
|
||||
|
|
|
@ -472,7 +472,6 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id),
|
||||
{
|
||||
"message_id": msg_id,
|
||||
"content": new_body,
|
||||
},
|
||||
)
|
||||
|
@ -492,7 +491,6 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
|||
result = self.client_patch(
|
||||
"/json/messages/" + str(msg_id),
|
||||
{
|
||||
"message_id": msg_id,
|
||||
"content": new_body,
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue