Move upload/download image action to right place

test_update_image is used to test image update API, it's quite
confusing that the upload/download image API is called.

And there is the test for upload/download image API already:
test_register_upload_get_image_file

We should move the upload/download action to the right place.

Change-Id: I18e13cdb81c5ec3fc4abcdd8c8fb21eaf05d4675
This commit is contained in:
wangxiyuan 2019-09-17 09:51:55 +08:00
parent 5cc1eb63f5
commit 99e4dcfbf3
1 changed files with 7 additions and 11 deletions

View File

@ -57,6 +57,13 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
self.assertIn('status', image)
self.assertEqual('queued', image['status'])
# NOTE: This Glance API returns different status codes for image
# condition. In this empty data case, Glance should return 204,
# so here should check the status code.
image_file = self.client.show_image_file(image['id'])
self.assertEqual(0, len(image_file.data))
self.assertEqual(204, image_file.response.status)
# Now try uploading an image file
file_content = data_utils.random_bytes()
image_file = six.BytesIO(file_content)
@ -115,17 +122,6 @@ class BasicOperationsImagesTest(base.BaseV2ImageTest):
visibility='private')
self.assertEqual('queued', image['status'])
# NOTE: This Glance API returns different status codes for image
# condition. In this empty data case, Glance should return 204,
# so here should check the status code.
image_file = self.client.show_image_file(image['id'])
self.assertEqual(0, len(image_file.data))
self.assertEqual(204, image_file.response.status)
# Now try uploading an image file
image_file = six.BytesIO(data_utils.random_bytes())
self.client.store_image_file(image['id'], image_file)
# Update Image
new_image_name = data_utils.rand_name('new-image')
self.client.update_image(image['id'], [