mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
api docs: Test sample fixture for nonexistent stream error.
In templates/zerver/api/stream-message.md, we have a sample fixture for when the target stream does not exist. This commit adds a test for that sample fixture.
This commit is contained in:
@@ -238,5 +238,10 @@
|
||||
"delete-queue": {
|
||||
"msg":"",
|
||||
"result":"success"
|
||||
},
|
||||
"nonexistent-stream-error": {
|
||||
"code":"BAD_REQUEST",
|
||||
"msg":"Stream 'nonexistent_stream' does not exist",
|
||||
"result":"error"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,13 +89,6 @@ A typical successful JSON response may look like:
|
||||
|
||||
{generate_code_example|remove-subscriptions|fixture}
|
||||
|
||||
A typical JSON response for when you try to unsubscribe from a stream
|
||||
that doesn't exist:
|
||||
A typical failed JSON response for when the target stream does not exist:
|
||||
|
||||
```
|
||||
{
|
||||
"msg":"Stream(s) (Denmarkk) do not exist",
|
||||
"code":"BAD_REQUEST",
|
||||
"result":"error"
|
||||
}
|
||||
```
|
||||
{generate_code_example|nonexistent-stream-error|fixture}
|
||||
|
||||
@@ -104,10 +104,4 @@ A typical successful JSON response may look like:
|
||||
|
||||
A typical failed JSON response for when the target stream does not exist:
|
||||
|
||||
```
|
||||
{
|
||||
'code':'BAD_REQUEST',
|
||||
'msg':"Stream 'Denmarkk' does not exist",
|
||||
'result':'error'
|
||||
}
|
||||
```
|
||||
{generate_code_example|nonexistent-stream-error|fixture}
|
||||
|
||||
@@ -251,6 +251,19 @@ def stream_message(client):
|
||||
|
||||
return message_id
|
||||
|
||||
def test_nonexistent_stream_error(client):
|
||||
# type: (Client) -> None
|
||||
request = {
|
||||
"type": "stream",
|
||||
"to": "nonexistent_stream",
|
||||
"subject": "Castle",
|
||||
"content": "Something is rotten in the state of Denmark."
|
||||
}
|
||||
result = client.send_message(request)
|
||||
|
||||
fixture = FIXTURES['nonexistent-stream-error']
|
||||
test_against_fixture(result, fixture)
|
||||
|
||||
def private_message(client):
|
||||
# type: (Client) -> None
|
||||
|
||||
@@ -394,6 +407,8 @@ def test_messages(client):
|
||||
update_message(client, message_id)
|
||||
private_message(client)
|
||||
|
||||
test_nonexistent_stream_error(client)
|
||||
|
||||
def test_users(client):
|
||||
# type: (Client) -> None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user