Update ImplementationCoverage for APIGateway (#3733)
This commit is contained in:
parent
62f5adddc4
commit
6da8dc0aec
@ -257,9 +257,9 @@
|
|||||||
|
|
||||||
## apigateway
|
## apigateway
|
||||||
<details>
|
<details>
|
||||||
<summary>34% implemented</summary>
|
<summary>38% implemented</summary>
|
||||||
|
|
||||||
- [ ] create_api_key
|
- [X] create_api_key
|
||||||
- [X] create_authorizer
|
- [X] create_authorizer
|
||||||
- [ ] create_base_path_mapping
|
- [ ] create_base_path_mapping
|
||||||
- [X] create_deployment
|
- [X] create_deployment
|
||||||
@ -274,7 +274,7 @@
|
|||||||
- [X] create_usage_plan
|
- [X] create_usage_plan
|
||||||
- [X] create_usage_plan_key
|
- [X] create_usage_plan_key
|
||||||
- [ ] create_vpc_link
|
- [ ] create_vpc_link
|
||||||
- [ ] delete_api_key
|
- [X] delete_api_key
|
||||||
- [X] delete_authorizer
|
- [X] delete_authorizer
|
||||||
- [ ] delete_base_path_mapping
|
- [ ] delete_base_path_mapping
|
||||||
- [ ] delete_client_certificate
|
- [ ] delete_client_certificate
|
||||||
@ -299,8 +299,8 @@
|
|||||||
- [ ] flush_stage_cache
|
- [ ] flush_stage_cache
|
||||||
- [ ] generate_client_certificate
|
- [ ] generate_client_certificate
|
||||||
- [ ] get_account
|
- [ ] get_account
|
||||||
- [ ] get_api_key
|
- [X] get_api_key
|
||||||
- [ ] get_api_keys
|
- [X] get_api_keys
|
||||||
- [X] get_authorizer
|
- [X] get_authorizer
|
||||||
- [X] get_authorizers
|
- [X] get_authorizers
|
||||||
- [ ] get_base_path_mapping
|
- [ ] get_base_path_mapping
|
||||||
|
@ -1155,18 +1155,18 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
api = self.get_rest_api(function_id)
|
api = self.get_rest_api(function_id)
|
||||||
return api.delete_deployment(deployment_id)
|
return api.delete_deployment(deployment_id)
|
||||||
|
|
||||||
def create_apikey(self, payload):
|
def create_api_key(self, payload):
|
||||||
if payload.get("value") is not None:
|
if payload.get("value") is not None:
|
||||||
if len(payload.get("value", [])) < 20:
|
if len(payload.get("value", [])) < 20:
|
||||||
raise ApiKeyValueMinLength()
|
raise ApiKeyValueMinLength()
|
||||||
for api_key in self.get_apikeys(include_values=True):
|
for api_key in self.get_api_keys(include_values=True):
|
||||||
if api_key.get("value") == payload["value"]:
|
if api_key.get("value") == payload["value"]:
|
||||||
raise ApiKeyAlreadyExists()
|
raise ApiKeyAlreadyExists()
|
||||||
key = ApiKey(**payload)
|
key = ApiKey(**payload)
|
||||||
self.keys[key["id"]] = key
|
self.keys[key["id"]] = key
|
||||||
return key
|
return key
|
||||||
|
|
||||||
def get_apikeys(self, include_values=False):
|
def get_api_keys(self, include_values=False):
|
||||||
api_keys = list(self.keys.values())
|
api_keys = list(self.keys.values())
|
||||||
|
|
||||||
if not include_values:
|
if not include_values:
|
||||||
@ -1179,7 +1179,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
|
|
||||||
return api_keys
|
return api_keys
|
||||||
|
|
||||||
def get_apikey(self, api_key_id, include_value=False):
|
def get_api_key(self, api_key_id, include_value=False):
|
||||||
api_key = self.keys[api_key_id]
|
api_key = self.keys[api_key_id]
|
||||||
|
|
||||||
if not include_value:
|
if not include_value:
|
||||||
@ -1189,11 +1189,11 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
|
|
||||||
return api_key
|
return api_key
|
||||||
|
|
||||||
def update_apikey(self, api_key_id, patch_operations):
|
def update_api_key(self, api_key_id, patch_operations):
|
||||||
key = self.keys[api_key_id]
|
key = self.keys[api_key_id]
|
||||||
return key.update_operations(patch_operations)
|
return key.update_operations(patch_operations)
|
||||||
|
|
||||||
def delete_apikey(self, api_key_id):
|
def delete_api_key(self, api_key_id):
|
||||||
self.keys.pop(api_key_id)
|
self.keys.pop(api_key_id)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
|
|
||||||
if self.method == "POST":
|
if self.method == "POST":
|
||||||
try:
|
try:
|
||||||
apikey_response = self.backend.create_apikey(json.loads(self.body))
|
apikey_response = self.backend.create_api_key(json.loads(self.body))
|
||||||
except ApiKeyAlreadyExists as error:
|
except ApiKeyAlreadyExists as error:
|
||||||
return (
|
return (
|
||||||
error.code,
|
error.code,
|
||||||
@ -451,7 +451,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
|
|
||||||
elif self.method == "GET":
|
elif self.method == "GET":
|
||||||
include_values = self._get_bool_param("includeValues")
|
include_values = self._get_bool_param("includeValues")
|
||||||
apikeys_response = self.backend.get_apikeys(include_values=include_values)
|
apikeys_response = self.backend.get_api_keys(include_values=include_values)
|
||||||
return 200, {}, json.dumps({"item": apikeys_response})
|
return 200, {}, json.dumps({"item": apikeys_response})
|
||||||
|
|
||||||
def apikey_individual(self, request, full_url, headers):
|
def apikey_individual(self, request, full_url, headers):
|
||||||
@ -463,14 +463,14 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
status_code = 200
|
status_code = 200
|
||||||
if self.method == "GET":
|
if self.method == "GET":
|
||||||
include_value = self._get_bool_param("includeValue")
|
include_value = self._get_bool_param("includeValue")
|
||||||
apikey_response = self.backend.get_apikey(
|
apikey_response = self.backend.get_api_key(
|
||||||
apikey, include_value=include_value
|
apikey, include_value=include_value
|
||||||
)
|
)
|
||||||
elif self.method == "PATCH":
|
elif self.method == "PATCH":
|
||||||
patch_operations = self._get_param("patchOperations")
|
patch_operations = self._get_param("patchOperations")
|
||||||
apikey_response = self.backend.update_apikey(apikey, patch_operations)
|
apikey_response = self.backend.update_api_key(apikey, patch_operations)
|
||||||
elif self.method == "DELETE":
|
elif self.method == "DELETE":
|
||||||
apikey_response = self.backend.delete_apikey(apikey)
|
apikey_response = self.backend.delete_api_key(apikey)
|
||||||
status_code = 202
|
status_code = 202
|
||||||
|
|
||||||
return status_code, {}, json.dumps(apikey_response)
|
return status_code, {}, json.dumps(apikey_response)
|
||||||
|
Loading…
Reference in New Issue
Block a user