api/delete-queue: Make fixtures/examples testable.

api/delete-queue now uses the Markdown extension in
bugdown/api_code_examples to generate code examples and fixtures
from tests.
This commit is contained in:
Eeshan Garg
2018-02-07 23:24:20 -03:30
committed by Tim Abbott
parent 344cf2c8ee
commit ac5c355a60
3 changed files with 21 additions and 18 deletions

View File

@@ -327,6 +327,18 @@ def register_queue(client):
return result['queue_id']
def deregister_queue(client, queue_id):
# type: (Client, str) -> None
# {code_example|start}
# Delete a queue (queue_id is the ID of the queue
# to be removed)
result = client.deregister(queue_id)
# {code_example|end}
fixture = FIXTURES['delete-queue']
test_against_fixture(result, fixture)
def test_invalid_api_key(client_with_invalid_key):
# type: (Client) -> None
result = client_with_invalid_key.list_subscriptions()
@@ -348,6 +360,7 @@ TEST_FUNCTIONS = {
'remove-subscriptions': remove_subscriptions,
'get-all-users': get_members,
'register-queue': register_queue,
'delete-queue': deregister_queue,
}
# SETUP METHODS FOLLOW
@@ -396,7 +409,8 @@ def test_streams(client):
def test_queues(client):
# type: (Client) -> None
register_queue(client)
queue_id = register_queue(client)
deregister_queue(client, queue_id)
def test_the_api(client):
# type: (Client) -> None