2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/d50bf81b0966/ changeset: d50bf81b0966 user: inithello date: 2012-12-07 18:04:42 summary: Generate new metadata when repository dependencies have been added or removed. affected #: 1 file
diff -r 0b3db8ce29d68bf7fe8e2a37699f58c2d9fdbddb -r d50bf81b096669ae82b614b94a606be773943445 lib/galaxy/webapps/community/controllers/common.py --- a/lib/galaxy/webapps/community/controllers/common.py +++ b/lib/galaxy/webapps/community/controllers/common.py @@ -504,6 +504,35 @@ # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file. reset_tool_data_tables( trans.app ) return repository, tool, message +def new_repository_dependency_metadata_required( trans, repository, metadata_dict ): + """ + Compare the last saved metadata for each repository dependency in the repository with the new + metadata in metadata_dict to determine if a new repository_metadata table record is required, + or if the last saved metadata record can be updated instead. + """ + if 'repository_dependencies' in metadata_dict: + repository_metadata = get_latest_repository_metadata( trans, repository.id ) + if repository_metadata: + metadata = repository_metadata.metadata + if metadata and 'repository_dependencies' in metadata: + saved_repository_dependencies = metadata[ 'repository_dependencies' ][ 'repository_dependencies' ] + new_repository_dependencies = metadata_dict[ 'repository_dependencies' ][ 'repository_dependencies' ] + # The saved metadata must be a subset of the new metadata. + for new_repository_dependency_metadata in new_repository_dependencies: + if new_repository_dependency_metadata not in saved_repository_dependencies: + return True + for saved_repository_dependency_metadata in saved_repository_dependencies: + if saved_repository_dependency_metadata not in new_repository_dependencies: + return True + else: + # We have repository metadata that does not include metadata for any repository dependencies in the + # repository, so we can update the existing repository metadata. + return False + else: + # There is no saved repository metadata, so we need to create a new repository_metadata table record. + return True + # The received metadata_dict includes no metadata for repository dependencies, so a new repository_metadata table record is not needed. + return False def new_tool_metadata_required( trans, repository, metadata_dict ): """ Compare the last saved metadata for each tool in the repository with the new metadata in metadata_dict to determine if a new repository_metadata @@ -579,7 +608,9 @@ if metadata_dict: downloadable = is_downloadable( metadata_dict ) repository_metadata = None - if new_tool_metadata_required( trans, repository, metadata_dict ) or new_workflow_metadata_required( trans, repository, metadata_dict ): + if new_repository_dependency_metadata_required( trans, repository, metadata_dict ) or \ + new_tool_metadata_required( trans, repository, metadata_dict ) or \ + new_workflow_metadata_required( trans, repository, metadata_dict ): # Create a new repository_metadata table row. repository_metadata = create_or_update_repository_metadata( trans, encoded_id,
https://bitbucket.org/galaxy/galaxy-central/changeset/330f05e523ae/ changeset: 330f05e523ae user: inithello date: 2012-12-07 18:05:43 summary: Tool shed functional tests for repository dependency features. Cleaned up import *s. affected #: 9 files
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/base/common.py --- a/test/tool_shed/base/common.py +++ b/test/tool_shed/base/common.py @@ -9,7 +9,7 @@ test_user_1_name = 'user1'
new_repository_dependencies_xml = '''<?xml version="1.0"?> -<repositories> +<repositories${description}><repository toolshed="${toolshed_url}" name="${repository_name}" owner="${owner}" changeset_revision="${changeset_revision}" /></repositories> '''
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -1,8 +1,7 @@ -from base.twilltestcase import * -from galaxy.webapps.community.util.hgweb_config import * -from test_db_util import * -from common import * -import string +import galaxy.webapps.community.util.hgweb_config +import common, string, os +from base.twilltestcase import tc, from_json_string, TwillTestCase, security +from test_db_util import get_repository_metadata_by_repository_id_changeset_revision
from galaxy import eggs eggs.require('mercurial') @@ -14,7 +13,7 @@ self.security = security.SecurityHelper( id_secret='changethisinproductiontoo' ) self.history_id = None self.hgweb_config_dir = os.environ.get( 'TEST_HG_WEB_CONFIG_DIR' ) - self.hgweb_config_manager = HgWebConfigManager() + self.hgweb_config_manager = galaxy.webapps.community.util.hgweb_config.HgWebConfigManager() self.hgweb_config_manager.hgweb_config_dir = self.hgweb_config_dir self.host = os.environ.get( 'TOOL_SHED_TEST_HOST' ) self.port = os.environ.get( 'TOOL_SHED_TEST_PORT' ) @@ -138,8 +137,12 @@ tc.fv( "1", "selected_files_to_delete", ','.join( files_to_delete ) ) tc.submit( 'select_files_to_delete_button' ) 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 ) + def display_manage_repository_page( self, repository, changeset_revision=None, strings_displayed=[], strings_not_displayed=[] ): + base_url = '/repository/manage_repository?id=%s' % self.security.encode_id( repository.id ) + if changeset_revision is not None: + url = '%s&changeset_revision=%s' % ( base_url, changeset_revision ) + else: + url = base_url self.visit_url( url ) self.check_for_strings( strings_displayed, strings_not_displayed ) def display_repository_clone_page( self, owner_name, repository_name, strings_displayed=[], strings_not_displayed=[] ): @@ -209,14 +212,19 @@ else: string = string.replace( character, replacement ) return string - def generate_repository_dependency_xml( self, repository, xml_filename ): + def generate_repository_dependency_xml( self, repository, xml_filename, dependency_description='' ): changeset_revision = self.get_repository_tip( repository ) - template_parser = string.Template( new_repository_dependencies_xml ) + if dependency_description: + description = ' description="%s"' % dependency_description + else: + description = dependency_description + template_parser = string.Template( common.new_repository_dependencies_xml ) repository_dependency_xml = template_parser.safe_substitute( toolshed_url=self.url, owner=repository.user.username, repository_name=repository.name, - changeset_revision=changeset_revision ) - # Save the generated xml to test-data/emboss_5/repository_dependencies.xml. + changeset_revision=changeset_revision, + description=description ) + # Save the generated xml to the specified location. file( xml_filename, 'w' ).write( repository_dependency_xml ) def get_latest_repository_metadata_for_repository( self, repository ): # TODO: This will not work as expected. Fix it. @@ -293,6 +301,13 @@ ( 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 repository_is_new( self, repository ): + repo = hg.repository( ui.ui(), self.get_repo_path( repository ) ) + tip_ctx = repo.changectx( repo.changelog.tip() ) + return tip_ctx.rev() < 0 + def reset_repository_metadata( self, repository ): + url = '/repository/reset_all_metadata?id=%s' % self.security.encode_id( repository.id ) + self.visit_url( url ) def revoke_write_access( self, repository, username ): url = '/repository/manage_repository?user_access_button=Remove&id=%s&remove_auth=%s' % \ ( self.security.encode_id( repository.id ), username )
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 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 @@ -1,5 +1,5 @@ -from tool_shed.base.twilltestcase import * -from tool_shed.base.test_db_util import * +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role
repository_name = 'filtering' repository_description = "Galaxy's filtering tool" @@ -9,14 +9,14 @@
def test_0000_initiate_users( self ): """Create necessary user accounts and login as an admin user.""" - self.login( email=test_user_1_email, username=test_user_1_name ) - test_user_1 = get_user( test_user_1_email ) + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = get_user( common.test_user_1_email ) assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % test_user_1_email test_user_1_private_role = get_private_role( test_user_1 ) self.logout() - self.login( email=admin_email, username=admin_username ) - admin_user = get_user( admin_email ) - assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = get_user( common.admin_email ) + assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email admin_user_private_role = get_private_role( admin_user ) def test_0005_create_categories( self ): """Create categories""" @@ -33,27 +33,27 @@ strings_displayed=strings_displayed ) def test_0015_edit_repository( self ): """Edit the repository name, description, and long description""" - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) new_name = "renamed_filtering" new_description = "Edited filtering tool" new_long_description = "Edited long description" self.edit_repository_information( repository, repo_name=new_name, description=new_description, long_description=new_long_description ) def test_0020_change_repository_category( self ): """Change the categories associated with the filtering repository""" - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.edit_repository_categories( repository, categories_to_add=[ "Text Analysis" ], categories_to_remove=[ "Text Manipulation" ] ) def test_0025_grant_write_access( self ): '''Grant write access to another user''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) - self.grant_write_access( repository, usernames=[ test_user_1_name ] ) - self.revoke_write_access( repository, test_user_1_name ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) + self.grant_write_access( repository, usernames=[ common.test_user_1_name ] ) + self.revoke_write_access( repository, common.test_user_1_name ) def test_0030_upload_filtering_1_1_0( self ): """Upload filtering_1.1.0.tar to the repository""" - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'filtering/filtering_1.1.0.tar', commit_message="Uploaded filtering 1.1.0" ) def test_0035_verify_repository( self ): '''Display basic repository pages''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) 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 ) @@ -61,12 +61,12 @@ 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, + self.display_repository_clone_page( common.admin_username, repository_name, strings_displayed=[ 'Uploaded filtering 1.1.0', latest_changeset_revision ] ) def test_0040_alter_repository_states( self ): '''Test toggling the malicious and deprecated repository flags.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.set_repository_malicious( repository, set_malicious=True, strings_displayed=[ 'The repository tip has been defined as malicious.' ] ) self.set_repository_malicious( repository, set_malicious=False, @@ -82,7 +82,7 @@ set_deprecated=False ) def test_0045_display_repository_tip_file( self ): '''Display the contents of filtering.xml in the repository tip revision''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.display_repository_file_contents( repository=repository, filename='filtering.xml', filepath=None, @@ -90,7 +90,7 @@ strings_not_displayed=[] ) def test_0050_upload_filtering_txt_file( self ): '''Upload filtering.txt file associated with tool version 1.1.0.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'filtering/filtering.txt', commit_message="Uploaded filtering.txt", @@ -99,7 +99,7 @@ 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 ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'filtering/filtering_test_data.tar', commit_message="Uploaded filtering test data", remove_repo_files_not_in_tar='No' ) self.display_repository_file_contents( repository=repository, filename='1.bed', @@ -109,14 +109,14 @@ self.check_repository_metadata( repository, tip_only=True ) def test_0060_upload_filtering_2_2_0( self ): '''Upload filtering version 2.2.0''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'filtering/filtering_2.2.0.tar', commit_message="Uploaded filtering 2.2.0", remove_repo_files_not_in_tar='No' ) 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 ) + repository = get_repository_by_name_and_owner( repository_name, common.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' ) @@ -126,7 +126,7 @@ 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.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'readme.txt', commit_message="Uploaded readme.txt" ) 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. @@ -134,13 +134,13 @@ 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 ) + repository = get_repository_by_name_and_owner( repository_name, common.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.display_manage_repository_page( repository, strings_displayed=[ 'Readme file for filtering 1.1.0' ] ) def test_0080_search_for_valid_filter_tool( self ): '''Search for the filtering tool by tool ID, name, and version.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) tip_changeset = self.get_repository_tip( repository ) 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=[] )
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/functional/test_0010_repository_with_tool_dependencies.py --- a/test/tool_shed/functional/test_0010_repository_with_tool_dependencies.py +++ b/test/tool_shed/functional/test_0010_repository_with_tool_dependencies.py @@ -1,5 +1,5 @@ -from tool_shed.base.twilltestcase import * -from tool_shed.base.test_db_util import * +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role
repository_name = 'freebayes' repository_description = "Galaxy's freebayes tool" @@ -10,8 +10,8 @@ def test_0000_create_or_login_admin_user( self ): """Create necessary user accounts and login as an admin user.""" self.logout() - self.login( email=admin_email, username=admin_username ) - admin_user = get_user( admin_email ) + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = get_user( common.admin_email ) assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email admin_user_private_role = get_private_role( admin_user ) def test_0005_create_category( self ): @@ -24,7 +24,7 @@ repository_long_description=repository_long_description, categories=[ 'SNP Analysis' ], strings_displayed=[] ) - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'freebayes/freebayes.xml', valid_tools_only=False, @@ -37,7 +37,7 @@ strings_displayed=[ 'requires an entry', 'tool_data_table_conf.xml' ] ) def test_0015_upload_missing_tool_data_table_conf_file( self ): '''Upload the missing tool_data_table_conf.xml.sample file to the repository.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'freebayes/tool_data_table_conf.xml.sample', valid_tools_only=False, @@ -50,27 +50,27 @@ strings_displayed=[ 'refers to a file', 'sam_fa_indices.loc' ] ) def test_0020_upload_missing_sample_loc_file( self ): '''Upload the missing sam_fa_indices.loc.sample file to the repository.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, 'freebayes/sam_fa_indices.loc.sample', strings_displayed=[], commit_message='Uploaded tool data table .loc file.' ) def test_0025_upload_invalid_tool_dependency_xml( self ): '''Upload tool_dependencies.xml defining version 0.9.5 of the freebayes package.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, os.path.join( 'freebayes', 'invalid_tool_dependencies', 'tool_dependencies.xml' ), strings_displayed=[ 'Name, version and type from a tool requirement tag does not match' ], commit_message='Uploaded invalid tool dependency XML.' ) def test_0030_upload_valid_tool_dependency_xml( self ): '''Upload tool_dependencies.xml defining version 0.9.4_9696d0ce8a962f7bb61c4791be5ce44312b81cf8 of the freebayes package.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.upload_file( repository, os.path.join( 'freebayes', 'tool_dependencies.xml' ), commit_message='Uploaded valid tool dependency XML.' ) def test_0035_verify_tool_dependencies( self ): '''Verify that the uploaded tool_dependencies.xml specifies the correct package versions.''' - repository = get_repository_by_name_and_owner( repository_name, admin_username ) + repository = get_repository_by_name_and_owner( repository_name, common.admin_username ) self.display_manage_repository_page( repository, strings_displayed=[ 'freebayes', '0.9.4_9696d0ce8a9', 'samtools', '0.1.18', 'Valid tools' ], strings_not_displayed=[ 'Invalid tools' ] )
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/functional/test_0020_basic_repository_dependencies.py --- a/test/tool_shed/functional/test_0020_basic_repository_dependencies.py +++ b/test/tool_shed/functional/test_0020_basic_repository_dependencies.py @@ -1,11 +1,11 @@ -from tool_shed.base.twilltestcase import * -from tool_shed.base.test_db_util import * +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role
datatypes_repository_name = 'emboss_datatypes' datatypes_repository_description = "Galaxy applicable data formats used by Emboss tools." datatypes_repository_long_description = "Galaxy applicable data formats used by Emboss tools. This repository contains no tools."
-emboss_repository_name = 'emboss_5' +emboss_repository_name = 'emboss_0020' emboss_repository_description = 'Galaxy wrappers for Emboss version 5.0.0 tools' emboss_repository_long_description = 'Galaxy wrappers for Emboss version 5.0.0 tools'
@@ -14,56 +14,56 @@ def test_0000_initiate_users( self ): """Create necessary user accounts and login as an admin user.""" self.logout() - self.login( email=admin_email, username=admin_username ) - admin_user = get_user( admin_email ) - assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = get_user( common.admin_email ) + assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email admin_user_private_role = get_private_role( admin_user ) self.logout() - self.login( email=test_user_1_email, username=test_user_1_name ) - test_user_1 = get_user( test_user_1_email ) - assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % regular_email + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = get_user( common.test_user_1_email ) + assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email test_user_1_private_role = get_private_role( test_user_1 ) def test_0005_create_category( self ): """Create Sequence Analysis category""" self.logout() - self.login( email=admin_email, username=admin_username ) + self.login( email=common.admin_email, username=common.admin_username ) self.create_category( 'Sequence Analysis', 'Tools for performing Protein and DNA/RNA analysis' ) def test_0010_create_emboss_datatypes_repository_and_upload_tarball( self ): '''Create and populate the emboss_datatypes repository.''' self.logout() - self.login( email=test_user_1_email, username=test_user_1_name ) + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) self.create_repository( datatypes_repository_name, datatypes_repository_description, repository_long_description=datatypes_repository_long_description, categories=[ 'Sequence Analysis' ], strings_displayed=[] ) - repository = get_repository_by_name_and_owner( datatypes_repository_name, test_user_1_name ) + repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) self.upload_file( repository, 'emboss/datatypes/datatypes_conf.xml', commit_message='Uploaded datatypes_conf.xml.' ) def test_0015_verify_datatypes_in_datatypes_repository( self ): '''Verify that the emboss_datatypes repository contains datatype entries.''' - repository = get_repository_by_name_and_owner( datatypes_repository_name, test_user_1_name ) + repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, strings_displayed=[ 'Datatypes', 'equicktandem', 'hennig86', 'vectorstrip' ] ) def test_0020_create_emboss_5_repository_and_upload_files( self ): - '''Create and populate the emboss_5 repository.''' + '''Create and populate the emboss_5_0020 repository.''' self.create_repository( emboss_repository_name, emboss_repository_description, repository_long_description=emboss_repository_long_description, categories=[ 'Text Manipulation' ], strings_displayed=[] ) - repository = get_repository_by_name_and_owner( emboss_repository_name, test_user_1_name ) - self.upload_file( repository, 'emboss/5/emboss.tar', commit_message='Uploaded emboss_5.tar' ) + repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + self.upload_file( repository, 'emboss/emboss.tar', commit_message='Uploaded emboss_5.tar' ) def test_0025_generate_and_upload_repository_dependencies_xml( self ): '''Generate and upload the repository_dependencies.xml file''' - repository = get_repository_by_name_and_owner( emboss_repository_name, test_user_1_name ) - datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, test_user_1_name ) + repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) self.generate_repository_dependency_xml( datatypes_repository, self.get_filename( 'emboss/5/repository_dependencies.xml' ) ) self.upload_file( repository, 'emboss/5/repository_dependencies.xml', commit_message='Uploaded repository_dependencies.xml' ) def test_0030_verify_emboss_5_repository_dependency_on_emboss_datatypes( self ): '''Verify that the emboss_5 repository now depends on the emboss_datatypes repository with correct name, owner, and changeset revision.''' - repository = get_repository_by_name_and_owner( emboss_repository_name, test_user_1_name ) - datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, test_user_1_name ) + repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) changeset_revision = self.get_repository_tip( datatypes_repository ) - strings_displayed = [ datatypes_repository_name, test_user_1_name, changeset_revision, 'Repository dependencies' ] + strings_displayed = [ datatypes_repository_name, common.test_user_1_name, changeset_revision, 'Repository dependencies' ] self.display_manage_repository_page( repository, strings_displayed=strings_displayed ) def test_0035_cleanup( self ): '''Clean up generated test data.'''
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/functional/test_0030_repository_dependency_revisions.py --- /dev/null +++ b/test/tool_shed/functional/test_0030_repository_dependency_revisions.py @@ -0,0 +1,134 @@ +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +from tool_shed.base.test_db_util import get_repository_by_name_and_owner, get_user, get_private_role + +datatypes_repository_name = 'emboss_datatypes' +datatypes_repository_description = "Galaxy applicable data formats used by Emboss tools." +datatypes_repository_long_description = "Galaxy applicable data formats used by Emboss tools. This repository contains no tools." + +emboss_repository_name = 'emboss' +emboss_5_repository_name = 'emboss_5_0030' +emboss_6_repository_name = 'emboss_6_0030' +emboss_repository_description = 'Galaxy wrappers for Emboss version 5.0.0 tools' +emboss_repository_long_description = 'Galaxy wrappers for Emboss version 5.0.0 tools' + +class TestRepositoryDependencyRevisions( ShedTwillTestCase ): + '''Test dependencies on different revisions of a repository.''' + ''' + create repository emboss_5_0030 + create repository emboss_6_0030 + create repository emboss_datatypes if necessary + create repository emboss + emboss_5 has repository_dependency.xml file that defines emboss_datatypes + emboss_6 has repository_dependency.xml file that defines emboss_datatypes + get information to create repository dependency imformation for emboss + emboss depends on emboss_5 + then emboss depends on emboss_6 + verify per-changeset dependencies + ''' + def test_0000_initiate_users( self ): + """Create necessary user accounts.""" + self.logout() + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = get_user( common.admin_email ) + assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email + admin_user_private_role = get_private_role( admin_user ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = get_user( common.test_user_1_email ) + assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % regular_email + test_user_1_private_role = get_private_role( test_user_1 ) + def test_0005_create_repositories( self ): + '''Create the emboss_5_0030, emboss_6_0030, emboss_datatypes, and emboss repositories and populate the emboss_datatypes repository.''' + emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) + if emboss_5_repository is None: + self.create_repository( emboss_5_repository_name, + emboss_repository_description, + repository_long_description=emboss_repository_long_description, + categories=[ 'Sequence Analysis' ], + strings_displayed=[] ) + emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) + self.upload_file( emboss_5_repository, 'emboss/emboss.tar', commit_message='Uploaded tool tarball.' ) + emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) + if emboss_6_repository is None: + self.create_repository( emboss_6_repository_name, + emboss_repository_description, + repository_long_description=emboss_repository_long_description, + categories=[ 'Sequence Analysis' ], + strings_displayed=[] ) + emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) + self.upload_file( emboss_6_repository, 'emboss/emboss.tar', commit_message='Uploaded tool tarball..' ) + datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) + if datatypes_repository is None: + self.create_repository( datatypes_repository_name, + datatypes_repository_description, + repository_long_description=datatypes_repository_long_description, + categories=[ 'Sequence Analysis' ], + strings_displayed=[] ) + datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) + if self.repository_is_new( datatypes_repository ): + self.upload_file( datatypes_repository, 'emboss/datatypes/datatypes_conf.xml', commit_message='Uploaded datatypes_conf.xml.' ) + emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + if emboss_repository is None: + self.create_repository( emboss_repository_name, + emboss_repository_description, + repository_long_description=emboss_repository_long_description, + categories=[ 'Sequence Analysis' ], + strings_displayed=[] ) + emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + self.upload_file( emboss_5_repository, 'emboss/emboss.tar', commit_message='Uploaded tool tarball.' ) + def test_0010_generate_repository_dependencies_for_emboss_5( self ): + '''Generate a repository_dependencies.xml file specifying emboss_datatypes and upload it to the emboss_5 repository.''' + datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) + self.generate_repository_dependency_xml( datatypes_repository, self.get_filename( 'emboss/repository_dependencies.xml' ) ) + emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) + self.upload_file( emboss_5_repository, 'emboss/repository_dependencies.xml', commit_message='Uploaded repository_depepndencies.xml.' ) + def test_0015_generate_repository_dependencies_for_emboss_6( self ): + '''Generate a repository_dependencies.xml file specifying emboss_datatypes and upload it to the emboss_6 repository.''' + emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) + self.upload_file( emboss_6_repository, 'emboss/repository_dependencies.xml', commit_message='Uploaded repository_depepndencies.xml.' ) + def test_0020_generate_repository_dependency_on_emboss_5( self ): + '''Create and upload repository_dependencies.xml for the emboss_5_0030 repository.''' + emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + emboss_5_repository = get_repository_by_name_and_owner( emboss_5_repository_name, common.test_user_1_name ) + self.generate_repository_dependency_xml( emboss_5_repository, + self.get_filename( 'emboss/5/repository_dependencies.xml' ), + dependency_description='Emboss requires the Emboss 5 repository.' ) + self.upload_file( emboss_repository, + 'emboss/5/repository_dependencies.xml', + commit_message='Uploaded dependency configuration specifying emboss_5' ) + def test_0025_generate_repository_dependency_on_emboss_6( self ): + '''Create and upload repository_dependencies.xml for the emboss_6_0030 repository.''' + emboss_repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + emboss_6_repository = get_repository_by_name_and_owner( emboss_6_repository_name, common.test_user_1_name ) + self.generate_repository_dependency_xml( emboss_6_repository, + self.get_filename( 'emboss/6/repository_dependencies.xml' ), + dependency_description='Emboss requires the Emboss 6 repository.' ) + self.upload_file( emboss_repository, + 'emboss/6/repository_dependencies.xml', + commit_message='Uploaded dependency configuration specifying emboss_6' ) + def test_0030_verify_repository_dependency_revisions( self ): + '''Verify that different metadata revisions of the emboss repository have different repository dependencies.''' + repository = get_repository_by_name_and_owner( emboss_repository_name, common.test_user_1_name ) + # Reset emboss metadata to pick up the repository dependency changes. +# self.reset_repository_metadata( repository ) + repository_metadata = [ ( metadata.metadata, metadata.changeset_revision ) for metadata in self.get_repository_metadata( repository ) ] + datatypes_repository = get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_1_name ) + datatypes_tip = self.get_repository_tip( datatypes_repository ) + # Iterate through all metadata revisions and check for repository dependencies. + for metadata, changeset_revision in repository_metadata: + repository_dependency_metadata = metadata[ 'repository_dependencies' ][ 'repository_dependencies' ][ 0 ] + # Remove the tool shed URL, because that's not displayed on the page (yet?) + repository_dependency_metadata.pop( repository_dependency_metadata.index( self.url ) ) + # Add the dependency description and datatypes repository details to the strings to check. + repository_dependency_metadata.extend( [ metadata[ 'repository_dependencies' ][ 'description' ], + datatypes_repository_name, + datatypes_repository.user.username, + datatypes_tip ] ) + self.display_manage_repository_page( repository, + changeset_revision=changeset_revision, + strings_displayed=[ str( metadata ) for metadata in repository_dependency_metadata ] ) + def test_0035_cleanup( self ): + '''Clean up generated repository dependency XML files.''' + for filename in [ 'emboss/5/repository_dependencies.xml', 'emboss/6/repository_dependencies.xml', 'emboss/repository_dependencies.xml' ]: + if os.path.exists( self.get_filename( filename ) ): + os.remove( self.get_filename( filename ) )
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/test_data/emboss/5/emboss.tar Binary file test/tool_shed/test_data/emboss/5/emboss.tar has changed
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/test_data/emboss/6/emboss.tar Binary file test/tool_shed/test_data/emboss/6/emboss.tar has changed
diff -r d50bf81b096669ae82b614b94a606be773943445 -r 330f05e523aee275c91f3e5de1177f8eb832d512 test/tool_shed/test_data/emboss/emboss.tar Binary file test/tool_shed/test_data/emboss/emboss.tar has changed
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.