'Here we test these functionalities
Register image, upload the image file, get image and get image
file api\'s'

@decorators.attr(type='smoke')
@decorators.idempotent_id('139b765e-7f3d-4b3d-8b37-3ca3876ee318')
def test_register_upload_get_image_file(self):

    uuid = '00000000-1111-2222-3333-444455556666'
    image_name = data_utils.rand_name('image')
    container_format = CONF.image.container_formats[0]
    disk_format = CONF.image.disk_formats[0]
    image = self.create_image(name=image_name, container_format=container_format, disk_format=disk_format, visibility='private', ramdisk_id=uuid)
    self.assertIn('name', image)
    self.assertEqual(image_name, image['name'])
    self.assertIn('visibility', image)
    self.assertEqual('private', image['visibility'])
    self.assertIn('status', image)
    self.assertEqual('queued', image['status'])
    file_content = data_utils.random_bytes()
    image_file = six.BytesIO(file_content)
    self.client.store_image_file(image['id'], image_file)
    body = self.client.show_image(image['id'])
    self.assertEqual(image['id'], body['id'])
    self.assertEqual(image_name, body['name'])
    self.assertEqual(uuid, body['ramdisk_id'])
    self.assertIn('size', body)
    self.assertEqual(1024, body.get('size'))
    body = self.client.show_image_file(image['id'])
    self.assertEqual(file_content, body.data)
