def test_get_key_pair_by_id(self): ctx = self.mock_cloudify_context('test_get_key_pair_by_id') current_ctx.set(ctx=ctx) client = self._get_ec2_client() kp = client.create_key_pair('test_get_key_pair_by_id') self.addCleanup(kp.delete) output = keypair._get_key_pair_by_id(kp.name) self.assertEqual(kp.name, output.name)
def test_get_key_pair_by_id(self): ctx = self.mock_cloudify_context( 'test_get_key_pair_by_id') current_ctx.set(ctx=ctx) client = self._get_ec2_client() kp = client.create_key_pair( 'test_get_key_pair_by_id') self.addCleanup(kp.delete) output = keypair._get_key_pair_by_id(kp.name) self.assertEqual(kp.name, output.name)
def test_get_key_pair_by_id(self): """ This tests that the _get_key_pair_by_id function returns the same keypair object. """ ctx = self.mock_ctx('test_get_key_pair_by_id') current_ctx.set(ctx=ctx) ec2_client = connection.EC2ConnectionClient().client() kp = ec2_client.create_key_pair('test_get_key_pair_by_id_bad_id') output = keypair._get_key_pair_by_id(kp.name) self.assertEqual(output.name, kp.name)