commit/galaxy-central: Dave Bouvier: Tool shed functional tests for repairing an installed repository.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ab4582614f70/ Changeset: ab4582614f70 User: Dave Bouvier Date: 2013-07-24 21:19:38 Summary: Tool shed functional tests for repairing an installed repository. Affected #: 2 files diff -r b42dfe74e237ea7f9c77059e427db92d9859bc67 -r ab4582614f70e35bb1023f73d4d2dc409225bc21 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -984,6 +984,12 @@ self.visit_url( url ) self.check_for_strings( [ 'All repository metadata has been reset.' ] ) + def repair_installed_repository( self, repository ): + repository_id = self.security.encode_id( repository.id ) + url = '/admin_toolshed/repair_repository?id=%s' % repository_id + self.visit_galaxy_url( url ) + self.submit_form( 'repair_repository', 'repair_repository_button' ) + def review_repository( self, repository, review_contents_dict, user=None, changeset_revision=None ): strings_displayed = [] strings_not_displayed = [] diff -r b42dfe74e237ea7f9c77059e427db92d9859bc67 -r ab4582614f70e35bb1023f73d4d2dc409225bc21 test/tool_shed/functional/test_1430_repair_installed_repository.py --- /dev/null +++ b/test/tool_shed/functional/test_1430_repair_installed_repository.py @@ -0,0 +1,180 @@ +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +import tool_shed.base.test_db_util as test_db_util + +import logging +log = logging.getLogger( __name__ ) + +category_name = 'Test 1430 Repair installed repository' +category_description = 'Test script 1430 for repairing an installed repository.' +filter_repository_name = 'filter_1430' +column_repository_name = 'column_1430' +filter_repository_description = "Galaxy's filter tool for test 1430" +column_repository_description = 'Add a value as a new column' +filter_repository_long_description = '%s: %s' % ( filter_repository_name, filter_repository_description ) +column_repository_long_description = '%s: %s' % ( column_repository_name, column_repository_description ) + +''' +In the Tool Shed: + +1) Create and populate the filter_1430 repository + +2) Create and populate the column_1430 repository + +3) Upload a repository_dependencies.xml file to the column_1430 repository that creates a repository dependency on the filter_1430 repository. + +In Galaxy: + +1) Install the column_1430 repository, making sure to check the checkbox to Handle repository dependencies so that the filter + repository is also installed. Make sure to install the repositories in a specified section of the tool panel. + +2) Uninstall the filter_1430 repository. + +3) Repair the column_1430 repository. + +4) Make sure the filter_1430 repository is reinstalled and the tool is loaded into the tool panel in the same section specified in step 1. +''' + +class TestRepairRepository( ShedTwillTestCase ): + '''Test repairing an installed repository.''' + + def test_0000_initiate_users_and_category( self ): + """Create necessary user accounts and login as an admin user.""" + self.logout() + self.login( email=common.admin_email, username=common.admin_username ) + admin_user = test_db_util.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 = test_db_util.get_private_role( admin_user ) + self.create_category( name=category_name, description=category_description ) + self.logout() + self.login( email=common.test_user_2_email, username=common.test_user_2_name ) + test_user_2 = test_db_util.get_user( common.test_user_2_email ) + assert test_user_2 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_2_email + test_user_2_private_role = test_db_util.get_private_role( test_user_2 ) + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + test_user_1 = test_db_util.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 = test_db_util.get_private_role( test_user_1 ) + + def test_0005_create_filter_repository( self ): + '''Create and populate the filter_1430 repository.''' + ''' + This is step 1 - Create and populate the filter_1430 repository. + + This repository will be depended on by the column_1430 repository. + ''' + category = test_db_util.get_category_by_name( category_name ) + repository = self.get_or_create_repository( name=filter_repository_name, + description=filter_repository_description, + long_description=filter_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + self.upload_file( repository, + filename='filtering/filtering_1.1.0.tar', + filepath=None, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Populate filter_1430 with version 1.1.0.', + strings_displayed=[], + strings_not_displayed=[] ) + + def test_0010_create_column_repository( self ): + '''Create and populate the column_1430 repository.''' + ''' + This is step 2 - Create and populate the column_1430 repository. + + This repository will depend on the filter_1430 repository. + ''' + category = test_db_util.get_category_by_name( category_name ) + repository = self.get_or_create_repository( name=column_repository_name, + description=column_repository_description, + long_description=column_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + self.upload_file( repository, + filename='column_maker/column_maker.tar', + filepath=None, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Populate column_1430 with tool definitions.', + strings_displayed=[], + strings_not_displayed=[] ) + + def test_0015_create_repository_dependency( self ): + '''Create a dependency on filter_1430.''' + ''' + This is step 3 - Upload a repository_dependencies.xml file to the column_1430 repository that creates a repository + dependency on the filter_1430 repository. + ''' + column_repository = test_db_util.get_repository_by_name_and_owner( 'column_1430', common.test_user_1_name ) + filter_repository = test_db_util.get_repository_by_name_and_owner( 'filter_1430', common.test_user_1_name ) + tool_shed_url = self.url + name = filter_repository.name + owner = filter_repository.user.username + changeset_revision = self.get_repository_tip( filter_repository ) + repository_dependency_tuple = ( tool_shed_url, name, owner, changeset_revision ) + filepath = self.generate_temp_path( '1430_repository_dependency' ) + self.create_repository_dependency( column_repository, [ repository_dependency_tuple ], filepath=filepath ) + + def test_0020_install_column_repository( self ): + '''Install the column_1430 repository into Galaxy.''' + ''' + This is step 1 (galaxy side) - Install the column_1430 repository, making sure to check the checkbox to + handle repository dependencies so that the filter_1430 repository is also installed. Make sure to install + the repositories in a specified section of the tool panel. + ''' + self.galaxy_logout() + self.galaxy_login( email=common.admin_email, username=common.admin_username ) + post_submit_strings_displayed = [ 'column_1430', 'filter_1430' ] + self.install_repository( 'column_1430', + common.test_user_1_name, + category_name, + new_tool_panel_section='repair', + post_submit_strings_displayed=post_submit_strings_displayed, + install_tool_dependencies=False, + install_repository_dependencies=True ) + + def test_0025_uninstall_filter_repository( self ): + '''Uninstall the filter_1430 repository from Galaxy.''' + ''' + This is step 2 - Uninstall the filter_1430 repository. + ''' + installed_repository = test_db_util.get_installed_repository_by_name_owner( 'filter_1430', common.test_user_1_name ) + self.uninstall_repository( installed_repository, remove_from_disk=True ) + strings_not_displayed = [ 'filter_1430', + "Galaxy's filter tool for test 1430", + installed_repository.installed_changeset_revision ] + self.display_galaxy_browse_repositories_page( strings_not_displayed=strings_not_displayed ) + + def test_0030_repair_column_repository( self ): + '''Repair the column_1430 repository.''' + ''' + This is step 3 - Repair the column_1430 repository. + ''' + column_repository = test_db_util.get_installed_repository_by_name_owner( 'column_1430', common.test_user_1_name ) + self.repair_installed_repository( column_repository ) + + def test_0035_verify_tool_panel_section( self ): + '''Check the tool panel section after repairing.''' + ''' + This is step 4 - Make sure the filter_1430 repository is reinstalled and the tool is loaded into the tool panel + in the same section specified in step 1. + ''' + filter_repository = test_db_util.get_installed_repository_by_name_owner( 'filter_1430', common.test_user_1_name ) + strings_displayed = [ 'filter_1430', + "Galaxy's filter tool for test 1430", + filter_repository.installed_changeset_revision ] + self.display_galaxy_browse_repositories_page( strings_displayed=strings_displayed ) + # Uninstall the filter repository again, so that the tool panel section metadata gets populated. + self.uninstall_repository( filter_repository, remove_from_disk=True ) + test_db_util.ga_refresh( filter_repository ) + tool_panel_section_metadata = filter_repository.metadata[ 'tool_panel_section' ] + for tool_id in tool_panel_section_metadata: + for panel_section in tool_panel_section_metadata[ tool_id ]: + assert panel_section[ 'name' ] == 'repair', 'Tool %s in tool panel section %s after repair, expected %s.' % \ + ( tool_id, panel_section[ 'name' ], 'repair' ) + 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)
-
commits-noreply@bitbucket.org