#NEWLINE# def _do_test_add_write_failure( self , errno , exception ) : #NEWLINE# #INDENT# ChunkedFile . CHUNKSIZE = units . Ki #NEWLINE# image_id = str ( uuid . uuid4 ( ) ) #NEWLINE# file_size = ( 5 * units . Ki ) #NEWLINE# file_contents = ( b'*' * file_size ) #NEWLINE# path = os . path . join ( self . test_dir , image_id ) #NEWLINE# image_file = six . BytesIO ( file_contents ) #NEWLINE# with mock . patch . object ( builtins , 'open' ) as popen : #NEWLINE# #INDENT# e = IOError ( ) #NEWLINE# e . errno = errno #NEWLINE# popen . side_effect = e #NEWLINE# self . assertRaises ( exception , self . store . add , image_id , image_file , 0 ) #NEWLINE# self . assertFalse ( os . path . exists ( path ) )