1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/21d10df2729b/ Changeset: 21d10df2729b User: dan Date: 2013-12-06 19:24:29 Summary: Add ToolShed Functional Tests for Data Managers. Affected #: 4 files diff -r b32f61600af7c50ac5c2da7be5ad13a696763ab8 -r 21d10df2729be014ef42db833ae73ff2f39e2d19 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -410,6 +410,20 @@ self.visit_galaxy_url( url ) self.check_for_strings( strings_displayed, strings_not_displayed ) + def display_installed_manage_data_manager_page( self, installed_repository, data_manager_names=None, strings_displayed=[], strings_not_displayed=[] ): + data_managers = installed_repository.metadata.get( 'data_manager', {} ).get( 'data_managers', {} ) + if data_manager_names: + if not isinstance( data_manager_names, list ): + data_manager_names = [data_manager_names] + for data_manager_name in data_manager_names: + assert data_manager_name in data_managers, "The requested Data Manager '%s' was not found in repository metadata." % data_manager_name + else: + data_manager_name = data_managers.keys() + for data_manager_name in data_manager_names: + url = '/data_manager/manage_data_manager?id=%s' % data_managers[data_manager_name]['guid'] + self.visit_galaxy_url( url ) + self.check_for_strings( strings_displayed, strings_not_displayed ) + def display_installed_repository_manage_page( self, installed_repository, strings_displayed=[], strings_not_displayed=[] ): url = '/admin_toolshed/manage_repository?id=%s' % self.security.encode_id( installed_repository.id ) self.visit_galaxy_url( url ) @@ -1314,6 +1328,7 @@ # <file path="tool-data/sam_fa_indices.loc" /> # </table> # </tables> + required_data_table_entry = None for table_elem in data_tables.findall( 'table' ): # The value of table_elem will be something like: <table comment_char="#" name="sam_fa_indexes"> for required_data_table_entry in required_data_table_entries: diff -r b32f61600af7c50ac5c2da7be5ad13a696763ab8 -r 21d10df2729be014ef42db833ae73ff2f39e2d19 test/tool_shed/functional/test_1460_data_managers.py --- /dev/null +++ b/test/tool_shed/functional/test_1460_data_managers.py @@ -0,0 +1,98 @@ +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 1460 Data Manager' +category_description = 'Test script 1460 for testing Data Managers' +data_manager_repository_name = 'data_manager_1460' +data_manager_repository_description = 'Repository that contains a Data Manager' +data_manager_repository_long_description = '%s: %s' % ( data_manager_repository_name, data_manager_repository_description ) +data_manager_name = 'testing_data_manager' +data_manager_tar_file = '1460_files/data_manager_files/test_data_manager.tar' + +''' +1. Add a Data Manager to toolshed + +2. install Data Manager + +3. Check that Data Manager tool + +''' + +#TODO: Allow testing actual Execution of installed Data Manager Tool. + +class TestDataManagers( ShedTwillTestCase ): + '''Test installing a repository containing a Data Manager.''' + + 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_0010_create_data_manager_repository( self ): + '''Create and populate data_manager_1460.''' + ''' + This is step 1 - Create repository data_manager_1460. + + Create and populate a repository that contains a Data manager. + ''' + category = test_db_util.get_category_by_name( category_name ) + repository = self.get_or_create_repository( name=data_manager_repository_name, + description=data_manager_repository_description, + long_description=data_manager_repository_long_description, + owner=common.test_user_1_name, + category_id=self.security.encode_id( category.id ), + strings_displayed=[] ) + # Upload the edited tool dependency definition to the package_lapack_3_4_1440 repository. + self.upload_file( repository, + filename=data_manager_tar_file, + filepath=None, + valid_tools_only=True, + uncompress_file=True, + remove_repo_files_not_in_tar=False, + commit_message='Populate %s with a data manager configuration.' % data_manager_repository_name, + strings_displayed=[], + strings_not_displayed=[] ) + + + def test_0020_install_data_manager_repository( self ): + '''Install the data_manager_1460 repository to galaxy.''' + ''' + This is step 3 - Attempt to install the repository into a galaxy instance, verify that it is installed. + ''' + self.galaxy_logout() + self.galaxy_login( email=common.admin_email, username=common.admin_username ) + post_submit_strings_displayed = [ data_manager_repository_name ] + self.install_repository( data_manager_repository_name, + common.test_user_1_name, + category_name, + install_tool_dependencies=True, + post_submit_strings_displayed=post_submit_strings_displayed ) + + def test_0030_verify_data_manager_tool( self ): + '''Verify that the data_manager_1460 repository is installed and Data Manager tool appears in list in Galaxy.''' + repository = test_db_util.get_installed_repository_by_name_owner( data_manager_repository_name, common.test_user_1_name ) + strings_displayed = [ 'Access managed data by job' ] + self.display_installed_manage_data_manager_page( repository, data_manager_names=data_manager_name, strings_displayed=strings_displayed ) + + def test_0040_verify_data_manager_data_table( self ): + '''Verify that the installed repository populated shed_tool_data_table.xml and the sample files.''' + self.verify_installed_repository_data_table_entries( required_data_table_entries=[ 'data_manager_test_data_table' ] ) + + diff -r b32f61600af7c50ac5c2da7be5ad13a696763ab8 -r 21d10df2729be014ef42db833ae73ff2f39e2d19 test/tool_shed/functional_tests.py --- a/test/tool_shed/functional_tests.py +++ b/test/tool_shed/functional_tests.py @@ -126,6 +126,11 @@ </tables> ''' +shed_data_manager_conf_xml_template = '''<?xml version="1.0"?> +<data_managers> +</data_managers> +''' + def run_tests( test_config ): loader = nose.loader.TestLoader( config=test_config ) plug_loader = test_config.plugins.prepareTestLoader( loader ) @@ -165,6 +170,7 @@ tempdir = tempfile.mkdtemp( dir=tool_shed_test_tmp_dir ) shed_db_path = os.path.join( tempdir, 'database' ) shed_tool_data_table_conf_file = os.environ.get( 'TOOL_SHED_TEST_TOOL_DATA_TABLE_CONF', os.path.join( tool_shed_test_tmp_dir, 'shed_tool_data_table_conf.xml' ) ) + galaxy_shed_data_manager_conf_file = os.environ.get( 'GALAXY_SHED_DATA_MANAGER_CONF', os.path.join( tool_shed_test_tmp_dir, 'test_shed_data_manager_conf.xml' ) ) galaxy_tool_data_table_conf_file = os.environ.get( 'GALAXY_TEST_TOOL_DATA_TABLE_CONF', os.path.join( tool_shed_test_tmp_dir, 'tool_data_table_conf.xml' ) ) galaxy_tool_conf_file = os.environ.get( 'GALAXY_TEST_TOOL_CONF', os.path.join( tool_shed_test_tmp_dir, 'test_tool_conf.xml' ) ) galaxy_shed_tool_conf_file = os.environ.get( 'GALAXY_TEST_SHED_TOOL_CONF', os.path.join( tool_shed_test_tmp_dir, 'test_shed_tool_conf.xml' ) ) @@ -330,6 +336,9 @@ migrated_tool_conf_xml = shed_tool_conf_template_parser.safe_substitute( shed_tool_path=galaxy_migrated_tool_path ) file( galaxy_migrated_tool_conf_file, 'w' ).write( migrated_tool_conf_xml ) os.environ[ 'GALAXY_TEST_SHED_TOOL_CONF' ] = galaxy_shed_tool_conf_file + # Generate shed_data_manager_conf.xml + if not os.environ.get( 'GALAXY_SHED_DATA_MANAGER_CONF' ): + open( galaxy_shed_data_manager_conf_file, 'wb' ).write( shed_data_manager_conf_xml_template ) galaxy_global_conf = get_webapp_global_conf() galaxy_global_conf[ '__file__' ] = 'universe_wsgi.ini.sample' @@ -351,6 +360,7 @@ migrated_tools_config = galaxy_migrated_tool_conf_file, new_file_path = galaxy_tempfiles, running_functional_tests=True, + shed_data_manager_config_file = galaxy_shed_data_manager_conf_file, shed_tool_data_table_config = shed_tool_data_table_conf_file, shed_tool_path = galaxy_shed_tool_path, template_path = "templates", diff -r b32f61600af7c50ac5c2da7be5ad13a696763ab8 -r 21d10df2729be014ef42db833ae73ff2f39e2d19 test/tool_shed/test_data/1460_files/data_manager_files/test_data_manager.tar Binary file test/tool_shed/test_data/1460_files/data_manager_files/test_data_manager.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.