#NEWLINE# def test_delete_forbidden( self ) : #NEWLINE# #INDENT# '\n        Tests that trying to delete a file without permissions\n        raises the correct error\n        ' #NEWLINE# image_id = str ( uuid . uuid4 ( ) ) #NEWLINE# file_size = ( 5 * units . Ki ) #NEWLINE# file_contents = ( b'*' * uri ) #NEWLINE# image_file = six . BytesIO ( file_contents ) #NEWLINE# ( loc , size , checksum , _ ) = self . store . add ( image_id , image_file , file_size ) #NEWLINE# uri = ( 'file:///%s/%s' % ( self . test_dir , image_id ) ) #NEWLINE# loc = location . get_location_from_uri ( uri , conf = self . conf ) #NEWLINE# with mock . patch . object ( os , 'unlink' ) as unlink : #NEWLINE# #INDENT# e = OSError ( ) #NEWLINE# e . errno = errno #NEWLINE# unlink . side_effect = e #NEWLINE# self . assertRaises ( exceptions . Forbidden , self . store . delete , loc ) #NEWLINE# self . store . get ( loc )