mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
api docs: Test sample fixture for message edit permission error.
In templates/zerver/api/update-message.md, we have a sample fixture for when a zulip.Client does not have the permission to update/edit a particular message. This commit adds a test for that fixture. Also, tools/test-api now also uses a non-admin client for this test, which might come in handy in the future.
This commit is contained in:
@@ -331,6 +331,25 @@ def update_message(client, message_id):
|
||||
assert result['result'] == 'success'
|
||||
assert result['raw_content'] == request['content']
|
||||
|
||||
def test_update_message_edit_permission_error(client, nonadmin_client):
|
||||
# type: (Client, Client) -> None
|
||||
request = {
|
||||
"type": "stream",
|
||||
"to": "Denmark",
|
||||
"subject": "Castle",
|
||||
"content": "Something is rotten in the state of Denmark."
|
||||
}
|
||||
result = client.send_message(request)
|
||||
|
||||
request = {
|
||||
"message_id": result["id"],
|
||||
"content": "New content"
|
||||
}
|
||||
result = nonadmin_client.update_message(request)
|
||||
|
||||
fixture = FIXTURES['update-message-edit-permission-error']
|
||||
test_against_fixture(result, fixture)
|
||||
|
||||
def register_queue(client):
|
||||
# type: (Client) -> str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user