<s> """<STR_LIT>""" <EOL> from cafe . drivers . unittest . decorators import tags <EOL> from cloudcafe . compute . common . exceptions import Forbidden , ItemNotFound <EOL> from cloudroast . images . fixtures import ImagesFixture <EOL> class TestDeleteImageNegative ( ImagesFixture ) : <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> super ( TestDeleteImageNegative , cls ) . setUpClass ( ) <EOL> cls . images = cls . images_behavior . create_images_via_task ( count = <NUM_LIT:3> ) <EOL> @ tags ( type = '<STR_LIT>' , regression = '<STR_LIT:true>' ) <EOL> def test_delete_image_using_blank_image_id ( self ) : <EOL> """<STR_LIT>""" <EOL> image_id = '<STR_LIT>' <EOL> with self . assertRaises ( ItemNotFound ) : <EOL> self . images_client . delete_image ( image_id ) <EOL> @ tags ( type = '<STR_LIT>' , regression = '<STR_LIT:true>' ) <EOL> def test_delete_image_using_invalid_image_id ( self ) : <EOL> """<STR_LIT>""" <EOL> image_id = '<STR_LIT>' <EOL> with self . assertRaises ( ItemNotFound ) : <EOL> self . images_client . delete_image ( image_id ) <EOL> @ tags ( type = '<STR_LIT>' , regression = '<STR_LIT:true>' ) <EOL> def test_delete_image_that_is_already_deleted ( self ) : <EOL> """<STR_LIT>""" <EOL> image = self . images . pop ( ) <EOL> response = self . images_client . delete_image ( image . id_ ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT> ) <EOL> with self . assertRaises ( ItemNotFound ) : <EOL> self . images_client . delete_image ( image . id_ ) <EOL> @ tags ( type = '<STR_LIT>' , regression = '<STR_LIT:true>' ) <EOL> def test_delete_image_that_is_protected ( self ) : <EOL> """<STR_LIT>""" <EOL> image = self . images . pop ( ) <EOL> protected = True <EOL> response = self . images_client . update_image ( <EOL> image . id_ , replace = { '<STR_LIT>' : protected } ) <EOL> self . assertEqual ( response . status_code , <NUM_LIT:200> ) <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . images_client . delete_image ( image . id_ ) <EOL> @ tags ( type = '<STR_LIT>' , regression = '<STR_LIT:true>' ) <EOL> def test_delete_image_as_member_of_shared_image ( self ) : <EOL> """<STR_LIT>""" <EOL> image = self . images . pop ( ) <EOL> member_id = self . alt_tenant_id <EOL> self . images_client . add_member ( image . id_ , member_id ) <EOL> with self . assertRaises ( Forbidden ) : <EOL> self . alt_images_client . delete_image ( image . id_ ) </s>
