#NEWLINE# def test_api_treats_size_as_a_normal_property( self ) : #NEWLINE# #INDENT# '\n        A test for LP bug #825024 -- glance client currently\n        treats size as a normal property.\n        ' #NEWLINE# self . cleanup ( ) #NEWLINE# self . start_servers ( ) #NEWLINE# with tempfile . NamedTemporaryFile ( ) as image_file : #NEWLINE# #INDENT# image_file . write ( 'XXX' ) #NEWLINE# image_file . flush ( ) #NEWLINE# image_file_name = image_file . name #NEWLINE# cmd = ( 'bin/glance --port=%d add is_public=True name=MyImage size=12345 < %s' % ( out . api_port , image_file_name ) ) #NEWLINE# ( exitcode , out , err ) = execute ( cmd ) #NEWLINE# #UNINDENT# image_id = out . strip ( ) . split ( ':' ) [ 1 ] . strip ( ) #NEWLINE# self . assertEqual ( 0 , exitcode ) #NEWLINE# self . assertTrue ( ( 'Found non-settable field size. Removing.' in out ) ) #NEWLINE# self . assertTrue ( ( ( 'Added new image with ID: %s' % image_id ) in out ) ) #NEWLINE# cmd = ( 'bin/glance --port=%d show %s' % ( self . api_port , image_id ) ) #NEWLINE# ( exitcode , out , err ) = execute ( cmd ) #NEWLINE# self . assertEqual ( 0 , exitcode ) #NEWLINE# lines = out . split ( '\n' ) [ 2 : ( - 1 ) ] #NEWLINE# self . assertFalse ( ( '12345' in out ) ) #NEWLINE# self . stop_servers ( )