1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/2ff24ef0746f/ Changeset: 2ff24ef0746f User: davebgx Date: 2014-04-29 21:39:43 Summary: Fix admin and library feature functional tests. Improve handling of checkbox parameters and multi-select inputs in functional tests. Affected #: 4 files diff -r b34eaa5eaa3176bc7498adcda597e7fa58996a2b -r 2ff24ef0746f3ef874d817052d48bf2278b10a33 test/base/twilltestcase.py --- a/test/base/twilltestcase.py +++ b/test/base/twilltestcase.py @@ -1312,7 +1312,7 @@ # Submit for refresh tc.submit( '___refresh_grouping___' ) - def visit_url( self, url, params=None, checkbox_params=None, allowed_codes=[ 200 ] ): + def visit_url( self, url, params=None, doseq=False, allowed_codes=[ 200 ] ): if params is None: params = dict() parsed_url = urlparse( url ) @@ -1325,26 +1325,7 @@ key, value = query_parameter.split( '=' ) params[ key ] = value if params: - url += '?%s' % urllib.urlencode( params ) - checked_boxes = dict() - unchecked_boxes = dict() - if checkbox_params is not None: - for checkbox_field in checkbox_params: - if checkbox_field in checked_boxes or checkbox_field in unchecked_boxes: - continue - if asbool( checkbox_params[ checkbox_field ] ): - checked_boxes[ checkbox_field ] = True - else: - unchecked_boxes[ checkbox_field ] = False - # Any checkbox field that is found twice in the controller's incoming parameters is considered checked, - # while any field that only appears once is considered unchecked. - checkbox_params = '&'.join( [ urllib.urlencode( checked_boxes ), - urllib.urlencode( checked_boxes ), - urllib.urlencode( unchecked_boxes ) ] ) - if params or parsed_url.query: - url += '&%s' % checkbox_params - else: - url += '?%s' % checkbox_params + url += '?%s' % urllib.urlencode( params, doseq=doseq ) new_url = tc.go( url ) return_code = tc.browser.get_code() assert return_code in allowed_codes, 'Invalid HTTP return code %s, allowed codes: %s' % \ @@ -1506,10 +1487,11 @@ if in_group_ids: url_params[ 'in_groups' ] = ','.join( in_group_ids ) if create_group_for_role == 'yes': - checkbox_params = dict( create_group_for_role='yes' ) + url_params[ 'create_group_for_role' ] = [ 'yes', 'yes' ] + doseq = True else: - checkbox_params = None - self.visit_url( url, url_params, checkbox_params=checkbox_params ) + doseq=False + self.visit_url( url, params=url_params, doseq=doseq ) for check_str in strings_displayed: self.check_page_for_string( check_str ) if private_role: @@ -1561,7 +1543,7 @@ self.check_page_for_string( check_str ) # Tests associated with groups - def create_group( self, name='Group One', in_user_ids=[], in_role_ids=[], create_role_for_group='', strings_displayed=[] ): + def create_group( self, name='Group One', in_user_ids=[], in_role_ids=[], create_role_for_group=False, strings_displayed=[] ): """Create a new group""" url = "/admin/groups" params = dict( operation='create', create_group_button='Save', name=name ) @@ -1569,11 +1551,13 @@ params [ 'in_users' ] = ','.join( in_user_ids ) if in_role_ids: params[ 'in_roles' ] = ','.join( in_role_ids ) - if create_role_for_group == 'yes': - checkbox_params = dict( create_role_for_group='yes' ) + if create_role_for_group: + params[ 'create_role_for_group' ] = [ 'yes', 'yes' ] + doseq = True else: - checkbox_params = None - self.visit_url( url, params=params, checkbox_params=checkbox_params ) + params[ 'create_role_for_group' ] = 'no' + doseq = False + self.visit_url( url, params=params, doseq=doseq ) for check_str in strings_displayed: self.check_page_for_string( check_str ) self.visit_url( "/admin/groups" ) @@ -2398,11 +2382,9 @@ #tc.fv( "1", "do_action", format ) #tc.submit( "action_on_datasets_button" ) # Here's the new approach... - url = "%s/library_common/act_on_multiple_datasets?cntrller=%s&library_id=%s&do_action=%s" \ - % ( self.url, cntrller, library_id, format ) - for ldda_id in ldda_ids: - url += "&ldda_ids=%s" % ldda_id - self.visit_url( url ) + params = dict( cntrller=cntrller, library_id=library_id, do_action=format, ldda_ids=ldda_ids ) + url = "/library_common/act_on_multiple_datasets" + self.visit_url( url, params, doseq=True ) tc.code( 200 ) archive = self.write_temp_file( self.last_page(), suffix='.' + format ) return archive diff -r b34eaa5eaa3176bc7498adcda597e7fa58996a2b -r 2ff24ef0746f3ef874d817052d48bf2278b10a33 test/functional/test_admin_features.py --- a/test/functional/test_admin_features.py +++ b/test/functional/test_admin_features.py @@ -209,7 +209,7 @@ self.create_group( name=name, in_user_ids=in_user_ids, in_role_ids=in_role_ids, - create_role_for_group='yes', + create_role_for_group=True, strings_displayed=[ "Group '%s' has been created with %d associated users and %d associated roles." % ( name, len( in_user_ids ), num_gras ), "One of the roles associated with this group is the newly created role with the same name." ] ) # Get the group object for later tests diff -r b34eaa5eaa3176bc7498adcda597e7fa58996a2b -r 2ff24ef0746f3ef874d817052d48bf2278b10a33 test/functional/test_library_features.py --- a/test/functional/test_library_features.py +++ b/test/functional/test_library_features.py @@ -69,7 +69,7 @@ self.library_info( 'library_admin', self.security.encode_id( library1.id ), library1.name, - new_name=name, + new_name='library1', new_description='library1 description', new_synopsis='library1 synopsis' ) refresh( library1 ) diff -r b34eaa5eaa3176bc7498adcda597e7fa58996a2b -r 2ff24ef0746f3ef874d817052d48bf2278b10a33 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -1053,10 +1053,19 @@ # form doesn't get parsed correctly. encoded_repository_id = self.security.encode_id( installed_repository.id ) params = dict( id=encoded_repository_id, no_changes=no_changes, new_tool_panel_section_label=new_tool_panel_section_label ) - checkbox_params = dict( install_repository_dependencies=install_repository_dependencies, - install_tool_dependencies=install_tool_dependencies ) + doseq = False + if install_repository_dependencies: + params[ 'install_repository_dependencies' ] = [ 'True', 'True' ] + doseq = True + else: + params[ 'install_repository_dependencies' ] = False + if install_tool_dependencies: + params[ 'install_tool_dependencies' ] = [ 'True', 'True' ] + doseq = True + else: + params[ 'install_tool_dependencies' ] = False url = '/admin_toolshed/reinstall_repository' - self.visit_galaxy_url( url, params=params, checkbox_params=checkbox_params ) + self.visit_galaxy_url( url, params=params, doseq=doseq ) # Manually initiate the install process, as with installing a repository. See comments in the # initiate_installation_process method for details. repository_ids = self.initiate_installation_process( install_tool_dependencies, @@ -1435,9 +1444,9 @@ self.visit_galaxy_url( url ) self.check_for_strings( strings, strings_not_displayed ) - def visit_galaxy_url( self, url, params=None, checkbox_params=None ): + def visit_galaxy_url( self, url, params=None, doseq=False ): url = '%s%s' % ( self.galaxy_url, url ) - self.visit_url( url, params=params, checkbox_params=checkbox_params ) + self.visit_url( url, params=params, doseq=doseq ) def wait_for_repository_installation( self, repository_ids ): final_states = [ galaxy_model.ToolShedRepository.installation_status.ERROR, Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.