Shared images test create with default visibility

As discussed on the openstack-dev mailing list[1] the
shared image test relies on known bugs[2] in the images API
by creating an image with private visibility and attempting
to share that image while it has private visibility.

This test was recently added without review or consideration
for the known bugs.[3]

The bug fix approved by the community is to introduce a new
visibility status of 'shared' and to use that visibility by
default on new image creation[4]. Therefore in this test,
an image must be created with default visibility to use the
image sharing feature.

Minor cleanup to the test is included to eliminate unnecessary
details and modifications for the tested scenario.

Note: This change is blocking to the implementation[5] of the
spec noted. That spec is blocking other work so this review
is a high priority for the Glance community.

[1] http://lists.openstack.org/pipermail/openstack-dev/2016-December/109370.html
[1] http://lists.openstack.org/pipermail/openstack-dev/2017-January/109678.html
[2] Related-Bug: 1452443
[2] Partial-Bug: 1394299
[3] Ia1369fa73f56ec290e868d3f2f2873785a70951d
[4] http://specs.openstack.org/openstack/glance-specs/specs/newton/approved/glance/community_visibility.html
[5] I94bc7708b291ce37319539e27b3e88c9a17e1a9f
Partially-Implements: bp community-level-v2-image-sharing

Change-Id: I6e3268f3712cbc0aadb51d204c694023b92d55a5
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 7b9244b..e7a10f3 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -337,17 +337,22 @@
 
     @test.idempotent_id('3fa50be4-8e38-4c02-a8db-7811bb780122')
     def test_list_images_param_member_status(self):
-        # Share one of the images created with the alt user
+        # Create an image to be shared using default visibility
+        image_file = six.BytesIO(data_utils.random_bytes(2048))
+        container_format = CONF.image.container_formats[0]
+        disk_format = CONF.image.disk_formats[0]
+        image = self.create_image(container_format=container_format,
+                                  disk_format=disk_format)
+        self.client.store_image_file(image['id'], data=image_file)
+
+        # Share the image created with the alt user
         self.image_member_client.create_image_member(
-            image_id=self.test_data['id'],
-            member=self.alt_img_client.tenant_id)
-        # Update the info on the test data so it remains accurate
-        self.test_data['updated_at'] = self.client.show_image(
-            self.test_data['id'])['updated_at']
+            image_id=image['id'], member=self.alt_img_client.tenant_id)
+
         # As an image consumer you need to provide the member_status parameter
         # along with the visibility=shared parameter in order for it to show
         # results
         params = {'member_status': 'pending', 'visibility': 'shared'}
         fetched_images = self.alt_img_client.list_images(params)['images']
         self.assertEqual(1, len(fetched_images))
-        self.assertEqual(self.test_data['id'], fetched_images[0]['id'])
+        self.assertEqual(image['id'], fetched_images[0]['id'])