From 112f539034fc1acc8b123406a9534ef1df97d626 Mon Sep 17 00:00:00 2001 From: Kartik Srivastava Date: Sun, 17 May 2020 00:27:15 +0530 Subject: [PATCH] openapi/python_examples: Update update_user example. This updates the `update_user` example to use `update_user_by_id`. --- zerver/openapi/python_examples.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/zerver/openapi/python_examples.py b/zerver/openapi/python_examples.py index 137f631350..e5fbed8841 100644 --- a/zerver/openapi/python_examples.py +++ b/zerver/openapi/python_examples.py @@ -232,26 +232,14 @@ def update_user(client: Client) -> None: # {code_example|start} # Change a user's full name. user_id = 10 - full_name = "New Name" - url = 'users/' + str(user_id) - result = client.call_endpoint( - url=url, - method='PATCH', - request={'full_name': json.dumps(full_name)} - ) + result = client.update_user_by_id(user_id, full_name = "New Name") # {code_example|end} validate_against_openapi_schema(result, '/users/{user_id}', 'patch', '200') # {code_example|start} # Change value of the custom profile field with ID 9. user_id = 8 - profile_data = [{'id': 9, 'value': 'some data'}] - url = 'users/' + str(user_id) - result = client.call_endpoint( - url=url, - method='PATCH', - request={'profile_data': json.dumps(profile_data)} - ) + result = client.update_user_by_id(user_id, profile_data = [{'id': 9, 'value': 'some data'}]) # {code_example|end} validate_against_openapi_schema(result, '/users/{user_id}', 'patch', '400')