#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . glance : ( 'image_list_detailed' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_modal_create_image_from_file( self ) : #NEWLINE# #INDENT# driver = self . selenium #NEWLINE# images = self . images . list ( ) #NEWLINE# api . glance . image_list_detailed ( IsA ( http . HttpRequest ) , marker = None ) . AndReturn ( [ images , False , False ] ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# driver . get ( ( '%s%s' % ( self . live_server_url , INDEX_URL ) ) ) #NEWLINE# driver . find_element_by_id ( 'images__action_create' ) . send_keys ( '\n' ) #NEWLINE# wait = self . ui . WebDriverWait ( driver , 10 , ignored_exceptions = [ socket_timeout ] ) #NEWLINE# wait . until ( ( lambda x : driver . find_element_by_id ( 'id_disk_format' ) ) ) #NEWLINE# srctypes = self . ui . Select ( driver . find_element_by_id ( 'id_source_type' ) ) #NEWLINE# srctypes . select_by_value ( 'file' ) #NEWLINE# driver . find_element_by_id ( 'id_image_file' ) . send_keys ( '/tmp/test.iso' ) #NEWLINE# formats = self . ui . Select ( driver . find_element_by_id ( 'id_disk_format' ) ) #NEWLINE# body = formats . first_selected_option #NEWLINE# self . assertTrue ( ( 'ISO' in body . text ) , 'ISO should be selected when the extension is *.iso' )