Fixing create_key_and_certificate boolean parameter (#1572)

This commit is contained in:
Akito Nozaki 2018-04-17 11:32:39 -07:00 committed by Jack Danger
parent 783504c897
commit ba3c9db8a7
2 changed files with 18 additions and 1 deletions

View File

@ -103,7 +103,7 @@ class IoTResponse(BaseResponse):
return json.dumps(dict())
def create_keys_and_certificate(self):
set_as_active = self._get_param("setAsActive")
set_as_active = self._get_bool_param("setAsActive")
cert, key_pair = self.iot_backend.create_keys_and_certificate(
set_as_active=set_as_active,
)

View File

@ -96,6 +96,23 @@ def test_certs():
res = client.list_certificates()
res.should.have.key('certificates').which.should.have.length_of(0)
@mock_iot
def test_certs_create_inactive():
client = boto3.client('iot', region_name='ap-northeast-1')
cert = client.create_keys_and_certificate(setAsActive=False)
cert_id = cert['certificateId']
cert = client.describe_certificate(certificateId=cert_id)
cert.should.have.key('certificateDescription')
cert_desc = cert['certificateDescription']
cert_desc.should.have.key('status').which.should.equal('INACTIVE')
client.update_certificate(certificateId=cert_id, newStatus='ACTIVE')
cert = client.describe_certificate(certificateId=cert_id)
cert.should.have.key('certificateDescription')
cert_desc = cert['certificateDescription']
cert_desc.should.have.key('status').which.should.equal('ACTIVE')
@mock_iot
def test_policy():
client = boto3.client('iot', region_name='ap-northeast-1')