fix #3131 fix API Gateway:delete_api_key return wrong status code (#3132)

* fix #3131 fix API Gateway:delete_api_key return wrong status code

* lint
This commit is contained in:
cm-iwata 2020-07-15 17:41:41 +09:00 committed by GitHub
parent b5c7356b20
commit 1b355f7f06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -466,6 +466,7 @@ class APIGatewayResponse(BaseResponse):
url_path_parts = self.path.split("/")
apikey = url_path_parts[2]
status_code = 200
if self.method == "GET":
apikey_response = self.backend.get_apikey(apikey)
elif self.method == "PATCH":
@ -473,7 +474,9 @@ class APIGatewayResponse(BaseResponse):
apikey_response = self.backend.update_apikey(apikey, patch_operations)
elif self.method == "DELETE":
apikey_response = self.backend.delete_apikey(apikey)
return 200, {}, json.dumps(apikey_response)
status_code = 202
return status_code, {}, json.dumps(apikey_response)
def usage_plans(self, request, full_url, headers):
self.setup_class(request, full_url, headers)

View File

@ -1906,7 +1906,8 @@ def test_api_keys():
response = client.get_api_keys()
len(response["items"]).should.equal(2)
client.delete_api_key(apiKey=apikey_id)
response = client.delete_api_key(apiKey=apikey_id)
response["ResponseMetadata"]["HTTPStatusCode"].should.equal(202)
response = client.get_api_keys()
len(response["items"]).should.equal(1)