1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/1cdb5f5eb6d0/ changeset: 1cdb5f5eb6d0 user: inithello date: 2012-12-11 16:47:31 summary: Functional tests for repositories with circular repository dependencies. affected #: 4 files
diff -r 795a1799e7dcf092b14f7e2a2dba3fb389403531 -r 1cdb5f5eb6d061b3232c4f7725839a9fe287355a test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -50,6 +50,9 @@ url = '/repository/view_changelog?id=%s' % self.security.encode_id( repository.id ) self.visit_url( url ) self.check_for_strings( strings_displayed, strings_not_displayed ) + def check_repository_dependency( self, repository, depends_on_repository, depends_on_changeset_revision ): + strings_displayed = [ depends_on_repository.name, depends_on_repository.user.username, depends_on_changeset_revision ] + self.display_manage_repository_page( repository, strings_displayed=strings_displayed ) def check_repository_metadata( self, repository, tip_only=True ): if tip_only: assert self.tip_has_metadata( repository ) and len( self.get_repository_metadata_revisions( repository ) ) == 1, \ @@ -353,7 +356,7 @@ **kwd ): self.visit_url( '/upload/upload?repository_id=%s' % self.security.encode_id( repository.id ) ) if valid_tools_only: - strings_displayed.append( "has been successfully uploaded to the repository." ) + strings_displayed.extend( [ 'has been successfully', 'uploaded to the repository.' ] ) for key in kwd: tc.fv( "1", key, kwd[ key ] ) tc.formfile( "1", "file_data", self.get_filename( filename, filepath ) )
diff -r 795a1799e7dcf092b14f7e2a2dba3fb389403531 -r 1cdb5f5eb6d061b3232c4f7725839a9fe287355a test/tool_shed/functional/test_0030_repository_dependency_revisions.py --- a/test/tool_shed/functional/test_0030_repository_dependency_revisions.py +++ b/test/tool_shed/functional/test_0030_repository_dependency_revisions.py @@ -18,7 +18,7 @@ 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 + 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=common.admin_email, username=common.admin_username ) @@ -28,7 +28,7 @@ def test_0005_create_category( self ): """Create a category for this test suite""" self.create_category( 'Test 0030 Repository Dependency Revisions', 'Testing repository dependencies by revision.' ) - def test_0005_create_repositories( self ): + def test_0010_create_repositories( self ): '''Create the emboss_5_0030, emboss_6_0030, emboss_datatypes, and emboss repositories and populate the emboss_datatypes repository.''' self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) @@ -69,7 +69,7 @@ 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 ): + def test_0015_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 ) repository_dependencies_path = self.generate_temp_path( 'test_0030', additional_paths=[ 'emboss' ] ) @@ -80,7 +80,7 @@ 'repository_dependencies.xml', filepath=repository_dependencies_path, commit_message='Uploaded repository_depepndencies.xml.' ) - def test_0015_generate_repository_dependencies_for_emboss_6( self ): + def test_0020_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 ) repository_dependencies_path = self.generate_temp_path( 'test_0030', additional_paths=[ 'emboss' ] ) @@ -88,7 +88,7 @@ 'repository_dependencies.xml', filepath=repository_dependencies_path, commit_message='Uploaded repository_depepndencies.xml.' ) - def test_0020_generate_repository_dependency_on_emboss_5( self ): + def test_0025_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 ) @@ -100,7 +100,7 @@ 'repository_dependencies.xml', filepath=repository_dependencies_path, commit_message='Uploaded dependency configuration specifying emboss_5' ) - def test_0025_generate_repository_dependency_on_emboss_6( self ): + def test_0030_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 ) @@ -112,7 +112,7 @@ 'repository_dependencies.xml', filepath=repository_dependencies_path, commit_message='Uploaded dependency configuration specifying emboss_6' ) - def test_0030_verify_repository_dependency_revisions( self ): + def test_0035_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 ) repository_metadata = [ ( metadata.metadata, metadata.changeset_revision ) for metadata in self.get_repository_metadata( repository ) ]
diff -r 795a1799e7dcf092b14f7e2a2dba3fb389403531 -r 1cdb5f5eb6d061b3232c4f7725839a9fe287355a test/tool_shed/functional/test_0040_repository_circular_dependencies.py --- /dev/null +++ b/test/tool_shed/functional/test_0040_repository_circular_dependencies.py @@ -0,0 +1,102 @@ +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 + +freebayes_repository_name = 'freebayes_0040' +freebayes_repository_name_description = "Galaxy's freebayes tool" +freebayes_repository_name_long_description = "Long description of Galaxy's freebayes tool" + +filtering_repository_name = 'filtering_0040' +filtering_repository_description = "Galaxy's filtering tool" +filtering_repository_long_description = "Long description of Galaxy's filtering tool" + +class TestRepositoryCircularDependencies( ShedTwillTestCase ): + '''Verify that the code correctly handles circular dependencies.''' + def test_0000_initiate_users( self ): + """Create necessary user accounts.""" + 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' % test_user_1_email + test_user_1_private_role = get_private_role( test_user_1 ) + 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 ) + def test_0005_create_category( self ): + """Create a category for this test suite""" + self.create_category( 'test_0040_repository_circular_dependencies', 'Testing handling of circular repository dependencies.' ) + def test_0010_create_freebayes_repository_name( self ): + '''Create and populate freebayes_0040.''' + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + self.create_repository( freebayes_repository_name, + freebayes_repository_name_description, + repository_long_description=freebayes_repository_name_long_description, + categories=[ 'test_0040_repository_circular_dependencies' ], + strings_displayed=[] ) + repository = get_repository_by_name_and_owner( freebayes_repository_name, common.test_user_1_name ) + self.upload_file( repository, + 'freebayes/freebayes.tar', + strings_displayed=[], + commit_message='Uploaded freebayes.tar.' ) + def test_0015_create_filtering_repository( self ): + '''Create and populate filtering_0040.''' + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + self.create_repository( filtering_repository_name, + filtering_repository_description, + repository_long_description=filtering_repository_long_description, + categories=[ 'test_0040_repository_circular_dependencies' ], + strings_displayed=[] ) + repository = get_repository_by_name_and_owner( filtering_repository_name, common.test_user_1_name ) + self.upload_file( repository, + 'filtering/filtering_1.1.0.tar', + strings_displayed=[], + commit_message='Uploaded filtering.tar.' ) + def test_0020_create_dependency_on_freebayes( self ): + '''Upload a repository_dependencies.xml file that specifies the current revision of freebayes to the filtering_0040 repository.''' + # The dependency structure should look like: + # Filtering revision 0 -> freebayes revision 0. + # Freebayes revision 0 -> filtering revision 1. + # Filtering will have two revisions, one with just the filtering tool, and one with the filtering tool and a dependency on freebayes. + repository = get_repository_by_name_and_owner( freebayes_repository_name, common.test_user_1_name ) + filtering_repository = get_repository_by_name_and_owner( filtering_repository_name, common.test_user_1_name ) + repository_dependencies_path = self.generate_temp_path( 'test_0040', additional_paths=[ 'filtering' ] ) + self.generate_repository_dependency_xml( repository, + self.get_filename( 'repository_dependencies.xml', filepath=repository_dependencies_path ), + dependency_description='Filtering 1.1.0 depends on the freebayes repository.' ) + self.upload_file( filtering_repository, + 'repository_dependencies.xml', + filepath=repository_dependencies_path, + commit_message='Uploaded dependency on freebayes' ) + def test_0025_create_dependency_on_filtering( self ): + '''Upload a repository_dependencies.xml file that specifies the current revision of filtering to the freebayes_0040 repository.''' + # The dependency structure should look like: + # Filtering revision 0 -> freebayes revision 0. + # Freebayes revision 0 -> filtering revision 1. + # Filtering will have two revisions, one with just the filtering tool, and one with the filtering tool and a dependency on freebayes. + repository = get_repository_by_name_and_owner( filtering_repository_name, common.test_user_1_name ) + freebayes_repository = get_repository_by_name_and_owner( freebayes_repository_name, common.test_user_1_name ) + repository_dependencies_path = self.generate_temp_path( 'test_0040', additional_paths=[ 'freebayes' ] ) + self.generate_repository_dependency_xml( repository, + self.get_filename( 'repository_dependencies.xml', filepath=repository_dependencies_path ), + dependency_description='Freebayes depends on the filtering repository.' ) + self.upload_file( freebayes_repository, + 'repository_dependencies.xml', + filepath=repository_dependencies_path, + commit_message='Uploaded dependency on filtering' ) + def test_0030_verify_repository_dependencies( self ): + '''Verify that each repository can depend on the other without causing an infinite loop.''' + filtering_repository = get_repository_by_name_and_owner( filtering_repository_name, common.test_user_1_name ) + freebayes_repository = get_repository_by_name_and_owner( freebayes_repository_name, common.test_user_1_name ) + # The dependency structure should look like: + # Filtering revision 0 -> freebayes revision 0. + # Freebayes revision 0 -> filtering revision 1. + # Filtering will have two revisions, one with just the filtering tool, and one with the filtering tool and a dependency on freebayes. + # In this case, the displayed dependency will specify the tip revision, but this will not always be the case. + filtering_strings_displayed = [ freebayes_repository_name, common.test_user_1_name, self.get_repository_tip( freebayes_repository ) ] + freebayes_strings_displayed = [ filtering_repository_name, common.test_user_1_name, self.get_repository_tip( filtering_repository ) ] + self.display_manage_repository_page( filtering_repository, strings_displayed=filtering_strings_displayed ) + self.display_manage_repository_page( freebayes_repository, strings_displayed=freebayes_strings_displayed ) +
diff -r 795a1799e7dcf092b14f7e2a2dba3fb389403531 -r 1cdb5f5eb6d061b3232c4f7725839a9fe287355a test/tool_shed/test_data/freebayes/freebayes.tar Binary file test/tool_shed/test_data/freebayes/freebayes.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.
galaxy-commits@lists.galaxyproject.org