commit/galaxy-central: inithello: Functional tests for repositories with workflows.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/4516a0bae905/ changeset: 4516a0bae905 user: inithello date: 2012-12-14 15:38:23 summary: Functional tests for repositories with workflows. affected #: 4 files diff -r 0ec7f0b6dec8707b6f4d114468367c9131e61200 -r 4516a0bae905696584040bf9237f1a628400ad37 test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -2,6 +2,7 @@ import galaxy.model as galaxy_model import common, string, os, re, test_db_util from base.twilltestcase import tc, from_json_string, TwillTestCase, security, urllib +from galaxy.tool_shed.encoding_util import tool_shed_encode from galaxy import eggs eggs.require('mercurial') @@ -52,8 +53,12 @@ self.check_repository_changelog( repository ) self.check_string_count_in_page( 'Repository metadata is associated with this change set.', metadata_count ) def check_installed_repository_tool_dependencies( self, installed_repository, dependencies_installed=False ): + # Tool dependencies are not being installed in these functional tests. If this is changed, the test method will also need to be updated. strings_not_displayed = [] - strings_displayed = [] + if not dependencies_installed: + strings_displayed = [ 'Missing tool dependencies' ] + else: + strings_displayed = [ 'Tool dependencies' ] for dependency in installed_repository.metadata[ 'tool_dependencies' ]: tool_dependency = installed_repository.metadata[ 'tool_dependencies' ][ dependency ] strings_displayed.extend( [ tool_dependency[ 'name' ], tool_dependency[ 'version' ], tool_dependency[ 'type' ] ] ) @@ -417,6 +422,12 @@ ( 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 load_workflow_image( self, repository, workflow_name, strings_displayed=[], strings_not_displayed=[] ): + metadata = self.get_repository_metadata( repository ) + url = '/workflow/generate_workflow_image?repository_metadata_id=%s&workflow_name=%s' % \ + ( self.security.encode_id( metadata[0].id ), tool_shed_encode( workflow_name ) ) + self.visit_url( url ) + self.check_for_strings( strings_displayed, strings_not_displayed ) def preview_repository_in_tool_shed( self, name, owner, changeset_revision=None, strings_displayed=[], strings_not_displayed=[] ): repository = test_db_util.get_repository_by_name_and_owner( name, owner ) if changeset_revision is None: diff -r 0ec7f0b6dec8707b6f4d114468367c9131e61200 -r 4516a0bae905696584040bf9237f1a628400ad37 test/tool_shed/functional/test_0060_workflows.py --- /dev/null +++ b/test/tool_shed/functional/test_0060_workflows.py @@ -0,0 +1,56 @@ +from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os +import tool_shed.base.test_db_util as test_db_util + +repository_name = 'filtering_0060' +repository_description = "Galaxy's filtering tool" +repository_long_description = "Long description of Galaxy's filtering tool" +workflow_repository_name = 'filtering_workflow_0060' +workflow_filename = 'Workflow_for_0060_filter_workflow_repository.ga' +workflow_name = 'Workflow for 0060_filter_workflow_repository' + +class TestToolShedWorkflowFeatures( ShedTwillTestCase ): + def test_0000_initiate_users( self ): + """Create necessary user accounts and login as an admin user.""" + 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' % test_user_1_email + test_user_1_private_role = test_db_util.get_private_role( test_user_1 ) + 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 ) + def test_0005_create_categories( self ): + """Create categories for this test suite""" + self.create_category( 'Test 0060 Workflow Features', 'Test 0060 - Workflow Features' ) + def test_0010_create_repository( self ): + """Create and populate the filtering repository""" + self.logout() + self.login( email=common.test_user_1_email, username=common.test_user_1_name ) + self.create_repository( repository_name, + repository_description, + repository_long_description=repository_long_description, + categories=[ 'Test 0060 Workflow Features' ], + strings_displayed=[] ) + def test_0015_upload_workflow( self ): + '''Upload a workflow with a missing tool, and verify that the tool specified is marked as missing.''' + repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) + workflow = file( self.get_filename( 'filtering_workflow/Workflow_for_0060_filter_workflow_repository.ga' ), 'r' ).read() + workflow = workflow.replace( '__TEST_TOOL_SHED_URL__', self.url.replace( 'http://', '' ) ) + workflow_filepath = self.generate_temp_path( 'test_0060', additional_paths=[ 'filtering_workflow' ] ) + os.makedirs( workflow_filepath ) + file( os.path.join( workflow_filepath, workflow_filename ), 'w+' ).write( workflow ) + self.upload_file( repository, + workflow_filename, + filepath=workflow_filepath, + commit_message='Uploaded filtering workflow.' ) + self.load_workflow_image( repository, workflow_name, strings_displayed=[ '#EBBCB2' ] ) + def test_0020_upload_tool( self ): + '''Upload the missing tool for the workflow in the previous step, and verify that the error is no longer present.''' + repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) + self.upload_file( repository, + 'filtering/filtering_2.2.0.tar', + commit_message="Uploaded filtering 2.2.0", + remove_repo_files_not_in_tar='No' ) + self.load_workflow_image( repository, workflow_name, strings_not_displayed=[ '#EBBCB2' ] ) diff -r 0ec7f0b6dec8707b6f4d114468367c9131e61200 -r 4516a0bae905696584040bf9237f1a628400ad37 test/tool_shed/functional_tests.py --- a/test/tool_shed/functional_tests.py +++ b/test/tool_shed/functional_tests.py @@ -224,7 +224,7 @@ log.info( "Embedded web server started" ) # ---- Optionally start up a Galaxy instance ------------------------------------------------------ - if 'TEST_TOOL_SHED_START_GALAXY' in os.environ: + if 'TOOL_SHED_TEST_OMIT_GALAXY' not in os.environ: # Generate the shed_tool_conf.xml and tool_sheds_conf.xml files tool_sheds_conf_template_parser = string.Template( tool_sheds_conf_xml_template ) tool_sheds_conf_xml = tool_sheds_conf_template_parser.safe_substitute( shed_url=tool_shed_test_host, shed_port=tool_shed_test_port ) @@ -346,16 +346,17 @@ toolshedapp.shutdown() toolshedapp = None log.info( "Embedded tool shed application stopped" ) - if galaxy_server: - log.info( "Shutting down galaxy web server" ) - galaxy_server.server_close() - galaxy_server = None - log.info( "Embedded galaxy server stopped" ) - if galaxyapp: - log.info( "Shutting down galaxy app" ) - galaxyapp.shutdown() - galaxyapp = None - log.info( "Embedded galaxy application stopped" ) + if 'TOOL_SHED_TEST_OMIT_GALAXY' not in os.environ: + if galaxy_server: + log.info( "Shutting down galaxy web server" ) + galaxy_server.server_close() + galaxy_server = None + log.info( "Embedded galaxy server stopped" ) + if galaxyapp: + log.info( "Shutting down galaxy app" ) + galaxyapp.shutdown() + galaxyapp = None + log.info( "Embedded galaxy application stopped" ) if 'TOOL_SHED_TEST_NO_CLEANUP' not in os.environ: try: for dir in [ tool_shed_test_tmp_dir ]: diff -r 0ec7f0b6dec8707b6f4d114468367c9131e61200 -r 4516a0bae905696584040bf9237f1a628400ad37 test/tool_shed/test_data/filtering_workflow/Workflow_for_0060_filter_workflow_repository.ga --- /dev/null +++ b/test/tool_shed/test_data/filtering_workflow/Workflow_for_0060_filter_workflow_repository.ga @@ -0,0 +1,60 @@ +{ + "a_galaxy_workflow": "true", + "annotation": "", + "format-version": "0.1", + "name": "Workflow for 0060_filter_workflow_repository", + "steps": { + "0": { + "annotation": "", + "id": 0, + "input_connections": {}, + "inputs": [ + { + "description": "", + "name": "Input Dataset" + } + ], + "name": "Input dataset", + "outputs": [], + "position": { + "left": 10, + "top": 10 + }, + "tool_errors": null, + "tool_id": null, + "tool_state": "{\"name\": \"Input Dataset\"}", + "tool_version": null, + "type": "data_input", + "user_outputs": [] + }, + "1": { + "annotation": "", + "id": 1, + "input_connections": { + "input": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [], + "name": "Filter", + "outputs": [ + { + "name": "out_file1", + "type": "input" + } + ], + "position": { + "left": 230, + "top": 10 + }, + "post_job_actions": {}, + "tool_errors": null, + "tool_id": "__TEST_TOOL_SHED_URL__/repos/user1/filtering_0060/Filter1/2.2.0", + "tool_state": "{\"__page__\": 0, \"cond\": \"\\\"c1=='chr22'\\\"\", \"chromInfo\": \"\\\"/Users/dave/Documents/workspace/dev-galaxy/tool-data/shared/ucsc/chrom/?.len\\\"\", \"input\": \"null\"}", + "tool_version": null, + "type": "tool", + "user_outputs": [] + } + } +} \ No newline at end of file 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