def test_instance_invalid_ami(self):
        ctx = self.mock_cloudify_context('test_instance_invalid_ami')
        current_ctx.set(ctx=ctx)

        image_id = 'ami-65b95565'

        with self.assertRaisesRegexp(NonRecoverableError,
                                     'InvalidAMIID.NotFound'):
            instance._get_image(image_id)
    def test_instance_invalid_ami(self):
        ctx = self.mock_cloudify_context(
            'test_instance_invalid_ami')
        current_ctx.set(ctx=ctx)

        image_id = 'ami-65b95565'

        with self.assertRaisesRegexp(
                NonRecoverableError,
                'InvalidAMIID.NotFound'):
            instance._get_image(image_id)
    def test_instance_get_image_id(self):

        ctx = self.mock_cloudify_context('test_instance_get_image_id')
        current_ctx.set(ctx=ctx)

        image_object = instance._get_image(self.env.ubuntu_trusty_image_id)
        self.assertEqual(image_object.id, self.env.ubuntu_trusty_image_id)
    def test_instance_get_image_id(self):

        ctx = self.mock_cloudify_context(
            'test_instance_get_image_id')
        current_ctx.set(ctx=ctx)

        image_object = instance._get_image(
            self.env.ubuntu_trusty_image_id)
        self.assertEqual(image_object.id,
                         self.env.ubuntu_trusty_image_id)