def test_validation(self):
    self.gc.image_find.side_effect = self.validate_result
    node = mock.Mock(id='NODE_ID', physical_id='NOVA_ID')
    image = 'IMAGE'
    if self.success:
        res = self.profile._validate_image(node, image, self.reason)
        self.assertIsNotNone(res)
        self.assertEqual(self.result, res.id)
    else:
        ex = self.assertRaises(self.exception, self.profile._validate_image, node, image, self.reason)
        self.assertEqual(self.message, six.text_type(ex))
    self.gc.image_find.assert_called_once_with(image, False)
def test_validation(self):
    self.gc.image_find.side_effect = self.validate_result
    node = mock.Mock(id='NODE_ID', physical_id='NOVA_ID')
    image = 'IMAGE'
    if self.success:
        res = self.profile._validate_image(node, image, self.reason)
        self.assertIsNotNone(res)
        self.assertEqual(self.result, res.id)
    else:
        ex = self.assertRaises(self.exception, self.profile._validate_image, node, image, self.reason)
        self.assertEqual(self.message, six.text_type(ex))
    self.gc.image_find.assert_called_once_with(image, False)