<s> """<STR_LIT>""" <EOL> from cafe . drivers . unittest . decorators import tags <EOL> from cloudcafe . images . common . types import ImageMemberStatus , ImageVisibility <EOL> from cloudroast . images . fixtures import ImagesFixture <EOL> class VisibilityOfImagesSharedBetweenUsersTest ( ImagesFixture ) : <EOL> @ tags ( type = '<STR_LIT>' , regression = '<STR_LIT:true>' ) <EOL> def test_visibility_of_images_shared_between_users ( self ) : <EOL> """<STR_LIT>""" <EOL> alt_tenant_id = self . alt_tenant_id <EOL> images = self . images_behavior . create_images_via_task ( count = <NUM_LIT:3> ) <EOL> image_share_accept = images . pop ( ) <EOL> image_share_reject = images . pop ( ) <EOL> image_share_pending = images . pop ( ) <EOL> alt_user_image = self . alt_images_behavior . create_image_via_task ( ) <EOL> third_user_image = self . third_images_behavior . create_image_via_task ( ) <EOL> for image_id in [ image_share_accept . id_ , image_share_reject . id_ , <EOL> image_share_pending . id_ ] : <EOL> response = self . images_client . add_member ( <EOL> image_id = image_id , member_id = alt_tenant_id ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> member = response . entity <EOL> self . assertEqual ( member . member_id , alt_tenant_id ) <EOL> self . assertEqual ( member . status , ImageMemberStatus . PENDING ) <EOL> response = self . alt_images_client . update_member ( <EOL> image_id = image_share_accept . id_ , member_id = alt_tenant_id , <EOL> status = ImageMemberStatus . ACCEPTED ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( response . entity . status , ImageMemberStatus . ACCEPTED ) <EOL> response = self . alt_images_client . update_member ( <EOL> image_id = image_share_reject . id_ , member_id = alt_tenant_id , <EOL> status = ImageMemberStatus . REJECTED ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( response . entity . status , ImageMemberStatus . REJECTED ) <EOL> response = self . alt_images_client . list_images ( ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> alt_user_images = response . entity <EOL> self . assertIn ( alt_user_image , alt_user_images ) <EOL> self . assertIn ( image_share_accept , alt_user_images ) <EOL> self . assertNotIn ( image_share_reject , alt_user_images ) <EOL> self . assertNotIn ( image_share_pending , alt_user_images ) <EOL> self . assertNotIn ( third_user_image , alt_user_images ) <EOL> response = self . alt_images_client . get_image ( <EOL> image_id = image_share_reject . id_ ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> image_rejected = response . entity <EOL> self . assertEqual ( image_rejected . id_ , image_share_reject . id_ ) <EOL> self . assertEqual ( image_rejected . visibility , ImageVisibility . PRIVATE ) <EOL> response = self . alt_images_client . get_image ( <EOL> image_id = image_share_pending . id_ ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> image_pending = response . entity <EOL> self . assertEqual ( image_pending . id_ , image_share_pending . id_ ) <EOL> self . assertEqual ( image_pending . visibility , ImageVisibility . PRIVATE ) </s>
