api/get-all-streams: Render multiple examples from single test method.

api/get-all-streams - make use of the api_code_example Markdown extension's
feature of recursively extracting multiple code examples from a single
test method.
This commit is contained in:
Eeshan Garg 2018-02-02 19:34:48 -03:30 committed by Tim Abbott
parent 0cca39d1fc
commit 7ae704d1bb
1 changed files with 10 additions and 5 deletions

View File

@ -92,20 +92,25 @@ def get_streams(client):
# {code_example|start}
# Get all streams that the user has access to
result = client.get_streams()
# You may pass in one or more of the query parameters mentioned above
# as keyword arguments, like so:
result = client.get_streams(include_public=True)
# {code_example|end}
fixture = FIXTURES['get-all-streams']
test_against_fixture(result, fixture, check_if_equal=['msg', 'result'],
check_if_exists=['streams'])
assert len(result['streams']) == len(fixture['streams'])
streams = [s for s in result['streams'] if s['name'] == 'new stream']
assert streams[0]['description'] == 'New stream for testing'
# {code_example|start}
# You may pass in one or more of the query parameters mentioned above
# as keyword arguments, like so:
result = client.get_streams(include_public=False)
# {code_example|end}
test_against_fixture(result, fixture, check_if_equal=['msg', 'result'],
check_if_exists=['streams'])
assert len(result['streams']) == 4
def get_subscribers(client):
# type: (Client) -> None