Merge pull request #1545 from haidaraM/fixApiKeyIdentification
Fix ApiGateway key identification
This commit is contained in:
commit
5f840aadcc
@ -563,17 +563,17 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
|
|
||||||
def create_apikey(self, payload):
|
def create_apikey(self, payload):
|
||||||
key = ApiKey(**payload)
|
key = ApiKey(**payload)
|
||||||
self.keys[key['value']] = key
|
self.keys[key['id']] = key
|
||||||
return key
|
return key
|
||||||
|
|
||||||
def get_apikeys(self):
|
def get_apikeys(self):
|
||||||
return list(self.keys.values())
|
return list(self.keys.values())
|
||||||
|
|
||||||
def get_apikey(self, value):
|
def get_apikey(self, api_key_id):
|
||||||
return self.keys[value]
|
return self.keys[api_key_id]
|
||||||
|
|
||||||
def delete_apikey(self, value):
|
def delete_apikey(self, api_key_id):
|
||||||
self.keys.pop(value)
|
self.keys.pop(api_key_id)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -976,22 +976,22 @@ def test_api_keys():
|
|||||||
apikey_name = 'TESTKEY1'
|
apikey_name = 'TESTKEY1'
|
||||||
payload = {'value': apikey_value, 'name': apikey_name}
|
payload = {'value': apikey_value, 'name': apikey_name}
|
||||||
response = client.create_api_key(**payload)
|
response = client.create_api_key(**payload)
|
||||||
apikey = client.get_api_key(apiKey=payload['value'])
|
apikey = client.get_api_key(apiKey=response['id'])
|
||||||
apikey['name'].should.equal(apikey_name)
|
apikey['name'].should.equal(apikey_name)
|
||||||
apikey['value'].should.equal(apikey_value)
|
apikey['value'].should.equal(apikey_value)
|
||||||
|
|
||||||
apikey_name = 'TESTKEY2'
|
apikey_name = 'TESTKEY2'
|
||||||
payload = {'name': apikey_name, 'generateDistinctId': True}
|
payload = {'name': apikey_name, 'generateDistinctId': True}
|
||||||
response = client.create_api_key(**payload)
|
response = client.create_api_key(**payload)
|
||||||
apikey = client.get_api_key(apiKey=response['value'])
|
apikey_id = response['id']
|
||||||
|
apikey = client.get_api_key(apiKey=apikey_id)
|
||||||
apikey['name'].should.equal(apikey_name)
|
apikey['name'].should.equal(apikey_name)
|
||||||
len(apikey['value']).should.equal(40)
|
len(apikey['value']).should.equal(40)
|
||||||
apikey_value = apikey['value']
|
|
||||||
|
|
||||||
response = client.get_api_keys()
|
response = client.get_api_keys()
|
||||||
len(response['items']).should.equal(2)
|
len(response['items']).should.equal(2)
|
||||||
|
|
||||||
client.delete_api_key(apiKey=apikey_value)
|
client.delete_api_key(apiKey=apikey_id)
|
||||||
|
|
||||||
response = client.get_api_keys()
|
response = client.get_api_keys()
|
||||||
len(response['items']).should.equal(1)
|
len(response['items']).should.equal(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user