commit/galaxy-central: inithello: More tool shed functional test fixes.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/7bfce80911c3/ changeset: 7bfce80911c3 user: inithello date: 2012-11-30 15:21:47 summary: More tool shed functional test fixes. affected #: 3 files diff -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 -r 7bfce80911c3a628710ebaaad0119ee46ea9e532 test/tool_shed/base/test_db_util.py --- a/test/tool_shed/base/test_db_util.py +++ b/test/tool_shed/base/test_db_util.py @@ -42,13 +42,13 @@ def get_repository_by_name_and_owner( name, owner_username ): owner = get_user_by_name( owner_username ) repository = sa_session.query( model.Repository ) \ - .filter( model.Repository.table.c.name==name ) \ - .filter( model.Repository.table.c.user_id==owner.id ) \ + .filter( and_( model.Repository.table.c.name == name, + model.Repository.table.c.user_id == owner.id ) ) \ .first() return repository def get_repository_metadata_by_repository_id_changeset_revision( repository_id, changeset_revision ): repository_metadata = sa_session.query( model.RepositoryMetadata ) \ - .filter( and_( model.RepositoryMetadata.table.c.id == repository_id, + .filter( and_( model.RepositoryMetadata.table.c.repository_id == repository_id, model.RepositoryMetadata.table.c.changeset_revision == changeset_revision ) ) \ .first() return repository_metadata diff -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 -r 7bfce80911c3a628710ebaaad0119ee46ea9e532 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -56,39 +56,6 @@ assert len( self.get_repository_metadata_revisions( repository ) ) > 0, \ 'Repository tip is not a metadata revision: Repository tip - %s, metadata revisions - %s.' % \ ( self.get_repository_tip( repository ), ', '.join( self.get_repository_metadata_revisions( repository ) ) ) - def check_repository_tools( self, repository, include_invalid=False ): - ''' - Loop through each repository_metadata dict in the repository object. - For each of these, check for a tools attribute, and load the tool metadata - page if it exists, then display that tool's page. - ''' - tool_list, invalid_tool_list = self.get_tools_from_repository_metadata( repository, include_invalid=include_invalid ) - for valid_tool_dict in tool_list: - changeset_revision = valid_tool_dict[ 'changeset_revision' ] - for tool in valid_tool_dict[ 'tools' ]: - metadata_strings_displayed = [ tool[ 'guid' ], - tool[ 'version' ], - tool[ 'id' ], - tool[ 'name' ], - tool[ 'description' ], - changeset_revision ] - url = '/repository/view_tool_metadata?repository_id=%s&changeset_revision=%s&tool_id=%s' % \ - ( self.security.encode_id( repository.id ), changeset_revision, tool[ 'id' ] ) - self.visit_url( url ) - self.check_for_strings( metadata_strings_displayed ) - self.load_display_tool_page( repository, tool_xml_path=tool[ 'tool_config' ], - changeset_revision=changeset_revision, - strings_displayed=[ '%s (version %s)' % ( tool[ 'name' ], tool[ 'version' ] ) ], - strings_not_displayed=[] ) - if include_invalid and invalid_tool_list: - for invalid_tool_dict in invalid_tool_list: - for tool in invalid_tool_dict[ 'tools' ]: - tool_path = '%s/%s' % ( self.get_repo_path( repository ), tool ) - self.load_display_tool_page( repository, - tool_xml_path=tool_path, - changeset_revision=changeset_revision, - strings_displayed=[ 'properly loaded' ], - strings_not_displayed=[] ) def check_repository_tools_for_changeset_revision( self, repository, changeset_revision ): ''' Loop through each tool dictionary in the repository metadata associated with the received changeset_revision. @@ -97,22 +64,32 @@ repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( repository.id, changeset_revision ) metadata = repository_metadata.metadata for tool_dict in metadata[ 'tools' ]: - metadata_strings_displayed = [ tool[ 'guid' ], - tool[ 'version' ], - tool[ 'id' ], - tool[ 'name' ], - tool[ 'description' ], + metadata_strings_displayed = [ tool_dict[ 'guid' ], + tool_dict[ 'version' ], + tool_dict[ 'id' ], + tool_dict[ 'name' ], + tool_dict[ 'description' ], changeset_revision ] url = '/repository/view_tool_metadata?repository_id=%s&changeset_revision=%s&tool_id=%s' % \ - ( self.security.encode_id( repository.id ), changeset_revision, tool[ 'id' ] ) + ( self.security.encode_id( repository.id ), changeset_revision, tool_dict[ 'id' ] ) self.visit_url( url ) self.check_for_strings( metadata_strings_displayed ) - self.load_display_tool_page( repository, tool_xml_path=tool[ 'tool_config' ], + self.load_display_tool_page( repository, tool_xml_path=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision, - strings_displayed=[ '%s (version %s)' % ( tool[ 'name' ], tool[ 'version' ] ) ], + strings_displayed=[ '%s (version %s)' % ( tool_dict[ 'name' ], tool_dict[ 'version' ] ) ], strings_not_displayed=[] ) def check_repository_invalid_tools_for_changeset_revision( self, repository, changeset_revision ): - pass + repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( repository.id, changeset_revision ) + metadata = repository_metadata.metadata + if 'invalid_tools' not in metadata: + return + for tool_xml in metadata[ 'tools' ]: + tool_path = '%s/%s' % ( self.get_repo_path( repository ), tool_xml ) + self.load_display_tool_page( repository, + tool_xml_path=tool_path, + changeset_revision=changeset_revision, + strings_displayed=[ 'properly loaded' ], + strings_not_displayed=[] ) def check_string_count_in_page( self, pattern, min_count, max_count=None ): """Checks the number of 'pattern' occurrences in the current browser page""" page = self.last_page() @@ -309,6 +286,15 @@ url = '/repository/manage_repository?user_access_button=Remove&id=%s&remove_auth=%s' % \ ( self.security.encode_id( repository.id ), username ) self.visit_url( url ) + def search_for_valid_tools( self, search_options={}, strings_displayed=[], strings_not_displayed=[] ): + for exact_matches in [ True, False ]: + for key, value in search_options.items(): + url = '/repository/find_tools' + self.visit_url( url ) + tc.fv( "1", "exact_matches", exact_matches ) + tc.fv( "1", key, value ) + tc.submit() + self.check_for_strings( strings_displayed, strings_not_displayed ) def set_repository_deprecated( self, repository, set_deprecated=True, strings_displayed=[], strings_not_displayed=[] ): url = '/repository/deprecate?id=%s&mark_deprecated=%s' % ( self.security.encode_id( repository.id ), set_deprecated ) self.visit_url( url ) diff -r e0e5462cb0495fc856ed5bd4a47bf386ac990a61 -r 7bfce80911c3a628710ebaaad0119ee46ea9e532 test/tool_shed/functional/test_0000_basic_repository_features.py --- a/test/tool_shed/functional/test_0000_basic_repository_features.py +++ b/test/tool_shed/functional/test_0000_basic_repository_features.py @@ -67,7 +67,8 @@ latest_changeset_revision = self.get_repository_tip( repository ) self.check_for_valid_tools( repository, strings_displayed=[ 'Filter1' ] ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=1 ) - self.check_repository_tools( repository ) + tip = self.get_repository_tip( repository ) + self.check_repository_tools_for_changeset_revision( repository, tip ) self.check_repository_metadata( repository, tip_only=False ) self.browse_repository( repository, strings_displayed=[ 'Browse %s revision' % repository.name, '(repository tip)' ] ) self.display_repository_clone_page( admin_username, @@ -125,11 +126,12 @@ def test_0065_verify_filtering_repository( self ): '''Verify the new tool versions and repository metadata.''' repository = get_repository_by_name_and_owner( repository_name, admin_username ) + tip = self.get_repository_tip( repository ) self.check_for_valid_tools( repository ) strings_displayed = self.get_repository_metadata_revisions( repository ).append( 'Select a revision' ) self.manage_repository( repository, strings_displayed=strings_displayed ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=2 ) - self.check_repository_tools( repository, include_invalid=False ) + self.check_repository_tools_for_changeset_revision( repository, tip ) self.check_repository_metadata( repository, tip_only=False ) def test_0070_upload_readme_txt_file( self ): '''Upload readme.txt file associated with tool version 2.2.0.''' @@ -151,3 +153,9 @@ # to a previous revision's readme file, if one exists. # TODO: All readme files should be displayed. self.display_readme_file( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + def test_0080_search_for_valid_filter_tool( self ): + '''Verify that the "search for valid tool" feature finds the filtering tool.''' + repository = get_repository_by_name_and_owner( repository_name, admin_username ) + tip_changeset = self.get_repository_tip( repository ) + search_options = dict( tool_id='Filter1', tool_name='filter', tool_version='2.2.0' ) + self.search_for_valid_tools( search_options=search_options, strings_displayed=[ tip_changeset ], strings_not_displayed=[] ) 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.
participants (1)
-
Bitbucket