commit/galaxy-central: inithello: More tool shed functional test enhancements.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/12f55a688c82/ changeset: 12f55a688c82 user: inithello date: 2012-12-03 16:07:31 summary: More tool shed functional test enhancements. affected #: 2 files diff -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 -r 12f55a688c82bb3e26de0ebba3cb202b16cf82e3 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -40,7 +40,7 @@ self.check_string_not_in_page( string ) def check_for_valid_tools( self, repository, strings_displayed=[], strings_not_displayed=[] ): strings_displayed.append( 'Valid tools' ) - self.manage_repository( repository, strings_displayed, strings_not_displayed ) + self.display_manage_repository_page( repository, strings_displayed, strings_not_displayed ) def check_count_of_metadata_revisions_associated_with_repository( self, repository, metadata_count ): self.check_repository_changelog( repository ) self.check_string_count_in_page( 'Repository metadata is associated with this change set.', metadata_count ) @@ -63,6 +63,8 @@ ''' repository_metadata = get_repository_metadata_by_repository_id_changeset_revision( repository.id, changeset_revision ) metadata = repository_metadata.metadata + if 'tools' not in metadata: + raise AssertionError( 'No tools in %s revision %s.' % ( repository.name, changeset_revision ) ) for tool_dict in metadata[ 'tools' ]: metadata_strings_displayed = [ tool_dict[ 'guid' ], tool_dict[ 'version' ], @@ -78,18 +80,18 @@ changeset_revision=changeset_revision, 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 ): + def check_repository_invalid_tools_for_changeset_revision( self, repository, changeset_revision, strings_displayed=[], strings_not_displayed=[] ): + '''Load the invalid tool page for each invalid tool associated with this changeset revision and verify the received error messages.''' 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, + for tool_xml in metadata[ 'invalid_tools' ]: + self.load_invalid_tool_page( repository, + tool_xml=tool_xml, changeset_revision=changeset_revision, - strings_displayed=[ 'properly loaded' ], - strings_not_displayed=[] ) + strings_displayed=strings_displayed, + strings_not_displayed=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() @@ -260,19 +262,23 @@ invalid_tools.append( dict( tools=repository_metadata.metadata[ 'invalid_tools' ], changeset_revision=repository_metadata.changeset_revision ) ) return valid_tools, invalid_tools def grant_write_access( self, repository, usernames=[], strings_displayed=[], strings_not_displayed=[] ): - self.manage_repository( repository ) + self.display_manage_repository_page( repository ) tc.fv( "3", "allow_push", '-Select one' ) for username in usernames: tc.fv( "3", "allow_push", '+%s' % username ) tc.submit( 'user_access_button' ) self.check_for_strings( strings_displayed, strings_not_displayed ) - def load_display_tool_page( self, repository, tool_xml_path, changeset_revision, strings_displayed=[], strings_not_displayed=[] ): - repository_id = self.security.encode_id( repository.id ) - url = '/repository/display_tool?repository_id=%s&tool_config=%s&changeset_revision=%s' % \ - ( repository_id, tool_xml_path, changeset_revision ) + def load_invalid_tool_page( self, repository, tool_xml, changeset_revision, strings_displayed=[], strings_not_displayed=[] ): + url = '/repository/load_invalid_tool?repository_id=%s&tool_config=%s&changeset_revision=%s' % \ + ( self.security.encode_id( repository.id ), tool_xml, changeset_revision ) self.visit_url( url ) self.check_for_strings( strings_displayed, strings_not_displayed ) - def manage_repository( self, repository, strings_displayed=[], strings_not_displayed=[] ): + def load_display_tool_page( self, repository, tool_xml_path, changeset_revision, strings_displayed=[], strings_not_displayed=[] ): + url = '/repository/display_tool?repository_id=%s&tool_config=%s&changeset_revision=%s' % \ + ( self.security.encode_id( repository.id ), tool_xml_path, changeset_revision ) + self.visit_url( url ) + self.check_for_strings( strings_displayed, strings_not_displayed ) + def display_manage_repository_page( self, repository, strings_displayed=[], strings_not_displayed=[] ): url = '/repository/manage_repository?id=%s' % self.security.encode_id( repository.id ) self.visit_url( url ) self.check_for_strings( strings_displayed, strings_not_displayed ) @@ -280,21 +286,20 @@ 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 search_for_valid_tools( self, search_fields={}, exact_matches=False, strings_displayed=[], strings_not_displayed=[] ): + for field_name, search_string in search_fields.items(): + url = '/repository/find_tools' + self.visit_url( url ) + tc.fv( "1", "exact_matches", exact_matches ) + tc.fv( "1", field_name, search_string ) + 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 ) self.check_for_strings( strings_displayed, strings_not_displayed ) def set_repository_malicious( self, repository, set_malicious=True, strings_displayed=[], strings_not_displayed=[] ): - self.manage_repository( repository ) + self.display_manage_repository_page( repository ) tc.fv( "malicious", "malicious", set_malicious ) tc.submit( "malicious_button" ) self.check_for_strings( strings_displayed, strings_not_displayed ) diff -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 -r 12f55a688c82bb3e26de0ebba3cb202b16cf82e3 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 @@ -83,9 +83,10 @@ strings_displayed=[ 'The repository tip has been defined as <b>not</b> malicious.' ] ) self.set_repository_deprecated( repository, strings_displayed=[ 'has been marked as deprecated', 'Mark as not deprecated' ] ) - self.manage_repository( repository, + self.display_manage_repository_page( repository, strings_displayed=[ 'This repository has been marked as deprecated' ], strings_not_displayed=[ 'Upload files', 'Reset all repository metadata' ] ) + self.browse_repository( repository, strings_not_displayed=[ 'Upload files' ] ) self.set_repository_deprecated( repository, strings_displayed=[ 'has been marked as not deprecated', 'Mark as deprecated' ], set_deprecated=False ) @@ -105,7 +106,7 @@ commit_message="Uploaded filtering.txt", uncompress_file='No', remove_repo_files_not_in_tar='No' ) - self.manage_repository( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0055_upload_filtering_test_data( self ): '''Upload filtering test data.''' repository = get_repository_by_name_and_owner( repository_name, admin_username ) @@ -129,7 +130,7 @@ 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.display_manage_repository_page( repository, strings_displayed=strings_displayed ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=2 ) self.check_repository_tools_for_changeset_revision( repository, tip ) self.check_repository_metadata( repository, tip_only=False ) @@ -137,19 +138,19 @@ '''Upload readme.txt file associated with tool version 2.2.0.''' repository = get_repository_by_name_and_owner( repository_name, admin_username ) self.upload_file( repository, 'readme.txt', commit_message="Uploaded readme.txt" ) - self.manage_repository( repository, strings_displayed=[ 'This is a readme file.' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'This is a readme file.' ] ) # Verify that there is a different readme file for each metadata revision. metadata_revisions = self.get_repository_metadata_revisions( repository ) - self.manage_repository( repository, strings_displayed=[ 'Readme file for filtering 1.1.0', 'This is a readme file.' ] ) + self.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0', 'This is a readme file.' ] ) def test_0075_delete_readme_txt_file( self ): '''Delete the readme.txt file.''' repository = get_repository_by_name_and_owner( repository_name, admin_username ) self.delete_files_from_repository( repository, filenames=[ 'readme.txt' ] ) self.check_count_of_metadata_revisions_associated_with_repository( repository, metadata_count=2 ) - self.manage_repository( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) + self.display_manage_repository_page( 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.''' + '''Search for the filtering tool by tool ID, name, and version.''' 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=[] ) + search_fields = dict( tool_id='Filter1', tool_name='filter', tool_version='2.2.0' ) + self.search_for_valid_tools( search_fields=search_fields, 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