Skip to content

Commit

Permalink
writing-bots.md: Add fixture JSON skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
roberthoenig authored and timabbott committed Feb 5, 2018
1 parent 7d977dd commit 12e7e25
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion templates/zerver/api/writing-bots.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,22 @@ following helper method:
# self.assert_bot_response(...)

`mock_http_conversation(fixture_name)` patches `requests.get` and returns the data specified
in the file `fixtures/<fixture_name>.py`. For an example, check out the [giphy bot](
in the file `fixtures/<fixture_name>.json`. Use the following JSON code as a skeleton for new
fixtures:
```
{
"request": {
"api_url": "http://api.example.com/",
"params": {
}
},
"response": {
},
"response-headers": {
}
}
```
For an example, check out the [giphy bot](
https://github.com/zulip/python-zulip-api/tree/master/zulip_bots/zulip_bots/bots/giphy).

*Tip: You can use [requestb.in](http://requestb.in) or a similar tool to capture payloads from the
Expand Down

0 comments on commit 12e7e25

Please sign in to comment.