fix API Gateway:create_usage_plan_key return wrong status code (#3134)

This commit is contained in:
cm-iwata 2020-07-15 22:01:03 +09:00 committed by GitHub
parent 4e4ce5f9f1
commit 419f3fba5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -528,13 +528,11 @@ class APIGatewayResponse(BaseResponse):
error.message, error.error_type
),
)
return 201, {}, json.dumps(usage_plan_response)
elif self.method == "GET":
usage_plans_response = self.backend.get_usage_plan_keys(usage_plan_id)
return 200, {}, json.dumps({"item": usage_plans_response})
return 200, {}, json.dumps(usage_plan_response)
def usage_plan_key_individual(self, request, full_url, headers):
self.setup_class(request, full_url, headers)

View File

@ -1989,6 +1989,7 @@ def test_usage_plan_keys():
key_type = "API_KEY"
payload = {"usagePlanId": usage_plan_id, "keyId": key_id, "keyType": key_type}
response = client.create_usage_plan_key(**payload)
response["ResponseMetadata"]["HTTPStatusCode"].should.equals(201)
usage_plan_key_id = response["id"]
# Get current plan keys (expect 1)