def integration_01b_upload_cert(self): actor = iam.UploadCert( 'Test', {'name': self.cert_name, 'public_key_path': 'examples/test/server.pem', 'private_key_path': 'examples/test/server.key'}) yield actor.execute()
def test_execute_dry(self): actor = iam.UploadCert('Unit Test', { 'name': 'test', 'public_key_path': 'test', 'private_key_path': 'test', 'cert_chain_path': 'test' }, dry=True) actor.iam_conn = mock.Mock() actor.readfile = mock.Mock() open_patcher = mock.patch('%s.open' % actor.__module__, create=True) with open_patcher: yield actor._execute() self.assertEquals(actor.iam_conn.upload_server_cert.call_count, 0)
def test_execute(self): actor = iam.UploadCert( 'Unit Test', { 'name': 'test', 'public_key_path': 'test', 'private_key_path': 'test', 'cert_chain_path': 'test' }) actor.iam_conn = mock.Mock() actor.readfile = mock.Mock() actor.iam_conn.upload_server_cert.side_effect = [None] yield actor._execute() # call count is 1 -- one extra retry due to BotoServerError above. self.assertEquals(actor.iam_conn.upload_server_cert.call_count, 1) actor.iam_conn.upload_server_cert.assert_called_with( path=None, private_key=actor.readfile(), cert_body=actor.readfile(), cert_name='test', cert_chain=actor.readfile())