'Tests the get_image_id function.'

def test_get_image_id(self):

    img_id = str(uuid.uuid4())
    img_name = 'myfakeimage'
    self.my_image.id = img_id
    self.my_image.name = img_name
    self.sahara_client.images.get.side_effect = [self.my_image, sahara_base.APIException(404), sahara_base.APIException(404)]
    self.sahara_client.images.find.side_effect = [[self.my_image], []]
    self.assertEqual(img_id, self.sahara_plugin.get_image_id(img_id))
    self.assertEqual(img_id, self.sahara_plugin.get_image_id(img_name))
    self.assertRaises(exception.EntityNotFound, self.sahara_plugin.get_image_id, 'noimage')
    calls = [mock.call(name=img_name), mock.call(name='noimage')]
    self.sahara_client.images.find.assert_has_calls(calls)
