writing-bots.md: Add fixture JSON skeleton.

This commit is contained in:
Robert Hönig 2018-02-05 15:05:40 +01:00 committed by Tim Abbott
parent 7d977dd059
commit 12e7e2557e
1 changed files with 16 additions and 1 deletions

View File

@ -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