api-docs: Update python usage example for archive_stream.

Even though there was a stream/channel ID being passed to the test
function for archive_stream, it wasn't being used in the test as
it was reset to a new stream created/subscribed in the function.

Updates the test function to remove the unused stream/channel ID
parameter, and updates the usage example for to use channel instead
of stream where appropriate.

Part of stream to channel rename project.
This commit is contained in:
Lauryn Menard 2024-05-19 13:26:40 +02:00 committed by Tim Abbott
parent af5d618879
commit deec077925
1 changed files with 5 additions and 6 deletions

View File

@ -632,19 +632,18 @@ def get_stream_id(client: Client) -> int:
@openapi_test_function("/streams/{stream_id}:delete")
def archive_stream(client: Client, stream_id: int) -> None:
def archive_stream(client: Client) -> None:
result = client.add_subscriptions(
streams=[
{
"name": "stream to be archived",
"description": "New stream for testing",
"name": "example to archive",
},
],
)
# {code_example|start}
# Archive the stream named 'stream to be archived'
stream_id = client.get_stream_id("stream to be archived")["stream_id"]
# Archive channel named "example to archive".
stream_id = client.get_stream_id("example to archive")["stream_id"]
result = client.delete_stream(stream_id)
# {code_example|end}
validate_against_openapi_schema(result, "/streams/{stream_id}", "delete", "200")
@ -1742,7 +1741,7 @@ def test_streams(client: Client, nonadmin_client: Client) -> None:
update_subscription_settings(client)
get_stream_topics(client, 1)
delete_topic(client, 1, "test")
archive_stream(client, stream_id)
archive_stream(client)
add_default_stream(client)
remove_default_stream(client)