mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Tool shed functional tests for: Citable URLs, simple repository dependencies with multiple repository owners.
This commit is contained in:
@@ -695,11 +695,37 @@ class ShedTwillTestCase( TwillTestCase ):
|
||||
self.check_for_strings( post_submit_strings_displayed, strings_not_displayed )
|
||||
repository_ids = self.initiate_installation_process( new_tool_panel_section=new_tool_panel_section )
|
||||
self.wait_for_repository_installation( repository_ids )
|
||||
def load_invalid_tool_page( self, repository, tool_xml, changeset_revision, strings_displayed=[], strings_not_displayed=[] ):
|
||||
url = '/repository/load_invalid_tool?repository_id=%s&tool_config=%s&changeset_revision=%s' % \
|
||||
( self.security.encode_id( repository.id ), tool_xml, changeset_revision )
|
||||
def load_citable_url( self,
|
||||
username,
|
||||
repository_name,
|
||||
changeset_revision,
|
||||
encoded_user_id,
|
||||
encoded_repository_id,
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[],
|
||||
strings_displayed_in_iframe=[],
|
||||
strings_not_displayed_in_iframe=[] ):
|
||||
url = '%s/view/%s' % ( self.url, username )
|
||||
# If repository name is passed in, append that to the url.
|
||||
if repository_name:
|
||||
url += '/%s' % repository_name
|
||||
if changeset_revision:
|
||||
# Changeset revision should never be provided unless repository name also is.
|
||||
assert repository_name is not None, 'Changeset revision is present, but repository name is not - aborting.'
|
||||
url += '/%s' % changeset_revision
|
||||
self.visit_url( url )
|
||||
self.check_for_strings( strings_displayed, strings_not_displayed )
|
||||
# Now load the page that should be displayed inside the iframe and check for strings.
|
||||
if encoded_repository_id:
|
||||
url = '/repository/view_repository?id=%s&operation=view_or_manage_repository' % encoded_repository_id
|
||||
if changeset_revision:
|
||||
url += '&changeset_revision=%s' % changeset_revision
|
||||
self.visit_url( url )
|
||||
self.check_for_strings( strings_displayed_in_iframe, strings_not_displayed_in_iframe )
|
||||
elif encoded_user_id:
|
||||
url = '/repository/browse_repositories?user_id=%s&operation=repositories_by_user' % encoded_user_id
|
||||
self.visit_url( url )
|
||||
self.check_for_strings( strings_displayed_in_iframe, strings_not_displayed_in_iframe )
|
||||
def load_display_tool_page( self, repository, tool_xml_path, changeset_revision, strings_displayed=[], strings_not_displayed=[] ):
|
||||
url = '/repository/display_tool?repository_id=%s&tool_config=%s&changeset_revision=%s' % \
|
||||
( self.security.encode_id( repository.id ), tool_xml_path, changeset_revision )
|
||||
@@ -709,6 +735,11 @@ class ShedTwillTestCase( TwillTestCase ):
|
||||
url = '/admin/review_tool_migration_stages'
|
||||
self.visit_galaxy_url( url )
|
||||
self.check_for_strings( strings_displayed, strings_not_displayed )
|
||||
def load_invalid_tool_page( self, repository, tool_xml, changeset_revision, strings_displayed=[], strings_not_displayed=[] ):
|
||||
url = '/repository/load_invalid_tool?repository_id=%s&tool_config=%s&changeset_revision=%s' % \
|
||||
( self.security.encode_id( repository.id ), tool_xml, changeset_revision )
|
||||
self.visit_url( url )
|
||||
self.check_for_strings( strings_displayed, strings_not_displayed )
|
||||
def load_workflow_image_in_tool_shed( self, repository, workflow_name, changeset_revision=None, strings_displayed=[], strings_not_displayed=[] ):
|
||||
if not changeset_revision:
|
||||
changeset_revision = self.get_repository_tip( repository )
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os
|
||||
import tool_shed.base.test_db_util as test_db_util
|
||||
|
||||
datatypes_repository_name = 'blast_datatypes_0120'
|
||||
datatypes_repository_description = 'Galaxy applicable datatypes for BLAST'
|
||||
datatypes_repository_long_description = 'Galaxy datatypes for the BLAST top hit descriptons tool'
|
||||
|
||||
tool_repository_name = 'blastxml_to_top_descr_0120'
|
||||
tool_repository_description = 'BLAST top hit descriptions'
|
||||
tool_repository_long_description = 'Make a table from BLAST XML'
|
||||
|
||||
'''
|
||||
Tool shed side:
|
||||
|
||||
1) Create and populate blast_datatypes_0120.
|
||||
1a) Check for appropriate strings.
|
||||
2) Create and populate blastxml_to_top_descr_0120.
|
||||
2a) Check for appropriate strings.
|
||||
3) Upload repository_dependencies.xml to blastxml_to_top_descr_0120 that defines a relationship to blast_datatypes_0120.
|
||||
3a) Check for appropriate strings.
|
||||
'''
|
||||
|
||||
base_datatypes_count = 0
|
||||
repository_datatypes_count = 0
|
||||
|
||||
class TestRepositoryMultipleOwners( ShedTwillTestCase ):
|
||||
def test_0000_initiate_users( self ):
|
||||
"""Create necessary user accounts and login as an admin user."""
|
||||
"""
|
||||
Create all the user accounts that are needed for this test script to run independently of other tests.
|
||||
Previously created accounts will not be re-created.
|
||||
"""
|
||||
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 )
|
||||
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_1_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.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_datatypes_repository( self ):
|
||||
"""Create and populate the blast_datatypes_0120 repository"""
|
||||
"""
|
||||
We are at step 1.
|
||||
Create and populate blast_datatypes.
|
||||
"""
|
||||
category = self.create_category( name='Test 0120', description='Description of test 0120' )
|
||||
self.logout()
|
||||
self.login( email=common.test_user_2_email, username=common.test_user_2_name )
|
||||
strings_displayed = [ 'Repository %s' % "'%s'" % datatypes_repository_name,
|
||||
'Repository %s has been created' % "'%s'" % datatypes_repository_name ]
|
||||
repository = self.get_or_create_repository( name=datatypes_repository_name,
|
||||
description=datatypes_repository_description,
|
||||
long_description=datatypes_repository_long_description,
|
||||
owner=common.test_user_2_name,
|
||||
category_id=self.security.encode_id( category.id ),
|
||||
strings_displayed=strings_displayed )
|
||||
self.upload_file( repository,
|
||||
filename='blast/blast_datatypes.tar',
|
||||
filepath=None,
|
||||
valid_tools_only=True,
|
||||
uncompress_file=True,
|
||||
remove_repo_files_not_in_tar=False,
|
||||
commit_message='Uploaded blast_datatypes tarball.',
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[] )
|
||||
def test_0010_verify_datatypes_repository( self ):
|
||||
'''Verify the blast_datatypes_0120 repository.'''
|
||||
'''
|
||||
We are at step 1a.
|
||||
Check for appropriate strings, most importantly BlastXml, BlastNucDb, and BlastProtDb,
|
||||
the datatypes that are defined in datatypes_conf.xml.
|
||||
'''
|
||||
global repository_datatypes_count
|
||||
repository = test_db_util.get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
strings_displayed = [ 'BlastXml', 'BlastNucDb', 'BlastProtDb', 'application/xml', 'text/html', 'blastxml', 'blastdbn', 'blastdbp']
|
||||
self.display_manage_repository_page( repository, strings_displayed=strings_displayed )
|
||||
repository_datatypes_count = int( self.get_repository_datatypes_count( repository ) )
|
||||
def test_0015_create_tool_repository( self ):
|
||||
"""Create and populate the blastxml_to_top_descr_0120 repository"""
|
||||
"""
|
||||
We are at step 2.
|
||||
Create and populate blastxml_to_top_descr_0120.
|
||||
"""
|
||||
category = self.create_category( name='Test 0120', description='Description of test 0120' )
|
||||
self.logout()
|
||||
self.login( email=common.test_user_1_email, username=common.test_user_1_name )
|
||||
strings_displayed = [ 'Repository %s' % "'%s'" % tool_repository_name,
|
||||
'Repository %s has been created' % "'%s'" % tool_repository_name ]
|
||||
repository = self.get_or_create_repository( name=tool_repository_name,
|
||||
description=tool_repository_description,
|
||||
long_description=tool_repository_long_description,
|
||||
owner=common.test_user_1_name,
|
||||
category_id=self.security.encode_id( category.id ),
|
||||
strings_displayed=strings_displayed )
|
||||
self.upload_file( repository,
|
||||
filename='blast/blastxml_to_top_descr.tar',
|
||||
filepath=None,
|
||||
valid_tools_only=True,
|
||||
uncompress_file=True,
|
||||
remove_repo_files_not_in_tar=False,
|
||||
commit_message='Uploaded blastxml_to_top_descr tarball.',
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[] )
|
||||
def test_0020_verify_tool_repository( self ):
|
||||
'''Verify the blastxml_to_top_descr_0120 repository.'''
|
||||
'''
|
||||
We are at step 2a.
|
||||
Check for appropriate strings, such as tool name, description, and version.
|
||||
'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( tool_repository_name, common.test_user_1_name )
|
||||
strings_displayed = [ 'blastxml_to_top_descr_0120', 'BLAST top hit descriptions', 'Make a table from BLAST XML' ]
|
||||
strings_displayed.extend( [ '0.0.1', 'Valid tools'] )
|
||||
self.display_manage_repository_page( repository, strings_displayed=strings_displayed )
|
||||
def test_0025_create_repository_dependency( self ):
|
||||
'''Create a repository dependency on blast_datatypes_0120.'''
|
||||
'''
|
||||
We are at step 3.
|
||||
Create a simple repository dependency for blastxml_to_top_descr_0120 that defines a dependency on blast_datatypes_0120.
|
||||
'''
|
||||
datatypes_repository = test_db_util.get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
tool_repository = test_db_util.get_repository_by_name_and_owner( tool_repository_name, common.test_user_1_name )
|
||||
dependency_xml_path = self.generate_temp_path( 'test_0120', additional_paths=[ 'dependencies' ] )
|
||||
self.create_repository_dependency( repository=tool_repository, depends_on=[ datatypes_repository ], filepath=dependency_xml_path )
|
||||
def test_0040_verify_repository_dependency( self ):
|
||||
'''Verify the created repository dependency.'''
|
||||
'''
|
||||
We are at step 3a.
|
||||
Check the newly created repository dependency to ensure that it was defined and displays correctly.
|
||||
'''
|
||||
datatypes_repository = test_db_util.get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
tool_repository = test_db_util.get_repository_by_name_and_owner( tool_repository_name, common.test_user_1_name )
|
||||
self.check_repository_dependency( tool_repository, datatypes_repository )
|
||||
@@ -0,0 +1,233 @@
|
||||
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__)
|
||||
|
||||
repository_name = 'filtering_0420'
|
||||
repository_description = 'Galaxy filtering tool for test 0420'
|
||||
repository_long_description = 'Long description of Galaxy filtering tool for test 0410'
|
||||
|
||||
first_changeset_hash = ''
|
||||
|
||||
'''
|
||||
1. Add and populate a repository to the tool shed with change set revision 0 (assume owner is test).
|
||||
2. Add valid change set revision 1.
|
||||
3. Visit the following url and check for appropriate strings: <tool shed base url>/view/user1
|
||||
4. Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/filtering_0420
|
||||
Resulting page should contain change set revision 1
|
||||
5. Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/filtering_0420/<revision 0>
|
||||
Resulting page should not contain change set revision 1, but should contain change set revision 0.
|
||||
6. Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/filtering_0420/<invalid revision>
|
||||
7. Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/<invalid repository name>
|
||||
8. Visit the following url and check for appropriate strings: <tool shed base url>/view/<invalid owner>
|
||||
'''
|
||||
|
||||
class TestRepositoryCitableURLs( ShedTwillTestCase ):
|
||||
'''Test repository citable url features.'''
|
||||
def test_0000_initiate_users( self ):
|
||||
"""Create necessary user accounts and login as an admin user."""
|
||||
"""
|
||||
Create all the user accounts that are needed for this test script to run independently of other tests.
|
||||
Previously created accounts will not be re-created.
|
||||
"""
|
||||
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 )
|
||||
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_repository( self ):
|
||||
"""Create and populate the filtering_0420 repository"""
|
||||
"""
|
||||
We are at step 1.
|
||||
Add and populate a repository to the tool shed with change set revision 0 (assume owner is test_user_1).
|
||||
"""
|
||||
global first_changeset_hash
|
||||
category = self.create_category( name='Test 0400 Repository Citable URLs',
|
||||
description='Test 0400 Repository Citable URLs category' )
|
||||
self.logout()
|
||||
self.login( email=common.test_user_1_email, username=common.test_user_1_name )
|
||||
strings_displayed = [ 'Repository %s' % "'%s'" % repository_name,
|
||||
'Repository %s has been created' % "'%s'" % repository_name ]
|
||||
repository = self.get_or_create_repository( name=repository_name,
|
||||
description=repository_description,
|
||||
long_description=repository_long_description,
|
||||
owner=common.test_user_1_name,
|
||||
category_id=self.security.encode_id( category.id ),
|
||||
strings_displayed=strings_displayed )
|
||||
self.upload_file( repository,
|
||||
filename='filtering/filtering_2.2.0.tar',
|
||||
filepath=None,
|
||||
valid_tools_only=True,
|
||||
uncompress_file=True,
|
||||
remove_repo_files_not_in_tar=False,
|
||||
commit_message='Uploaded filtering 2.2.0 tarball.',
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[] )
|
||||
# We'll be checking for this hash later, after uploading another file to the repository, making get_repository_tip() not usable.
|
||||
first_changeset_hash = self.get_repository_tip( repository )
|
||||
def test_0010_upload_new_file_to_repository( self ):
|
||||
'''Upload a readme file to the repository in order to create a second changeset revision.'''
|
||||
'''
|
||||
We are at step 2.
|
||||
Add valid change set revision 1.
|
||||
The repository should now contain two changeset revisions, 0:<revision hash> and 1:<revision hash>.
|
||||
'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
|
||||
self.upload_file( repository,
|
||||
filename='readme.txt',
|
||||
filepath=None,
|
||||
valid_tools_only=True,
|
||||
uncompress_file=True,
|
||||
remove_repo_files_not_in_tar=False,
|
||||
commit_message='Uploaded readme.txt.',
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[] )
|
||||
def test_0015_load_user_view_page( self ):
|
||||
'''Load the /view/<username> page amd check for strings.'''
|
||||
'''
|
||||
We are at step 3.
|
||||
Visit the following url and check for appropriate strings: <tool shed base url>/view/user1
|
||||
'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
|
||||
test_user_1 = test_db_util.get_user( common.test_user_1_email )
|
||||
encoded_user_id = self.security.encode_id( test_user_1.id )
|
||||
# Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
|
||||
# then directly load the url that the iframe should be loading and check for the expected strings.
|
||||
# The iframe should point to /repository/browse_repositories?user_id=<encoded user ID>&operation=repositories_by_user
|
||||
strings_displayed = [ '/repository/browse_repositories', encoded_user_id, 'operation=repositories_by_user' ]
|
||||
strings_displayed.append( encoded_user_id )
|
||||
strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420' ]
|
||||
strings_displayed_in_iframe.append( self.get_repository_tip( repository ) )
|
||||
self.load_citable_url( username='user1',
|
||||
repository_name=None,
|
||||
changeset_revision=None,
|
||||
encoded_user_id=encoded_user_id,
|
||||
encoded_repository_id=None,
|
||||
strings_displayed=strings_displayed,
|
||||
strings_displayed_in_iframe=strings_displayed_in_iframe )
|
||||
def test_0020_load_repository_view_page( self ):
|
||||
'''Load the /view/<user>/<repository> page and check for the appropriate strings.'''
|
||||
'''
|
||||
We are at step 4.
|
||||
Visit the following url and check for strings: <tool shed base url>/view/user1/filtering_0420
|
||||
Resulting page should contain change set revision 1
|
||||
'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
|
||||
test_user_1 = test_db_util.get_user( common.test_user_1_email )
|
||||
encoded_user_id = self.security.encode_id( test_user_1.id )
|
||||
encoded_repository_id = self.security.encode_id( repository.id )
|
||||
# Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
|
||||
# then directly load the url that the iframe should be loading and check for the expected strings.
|
||||
# The iframe should point to /repository/bview_repository?id=<encoded repository ID>
|
||||
strings_displayed = [ '/repository', 'view_repository', 'id=', encoded_repository_id ]
|
||||
strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420' ]
|
||||
strings_displayed_in_iframe.append( self.get_repository_tip( repository ) )
|
||||
strings_displayed_in_iframe.append( 'Sharable link to this repository:' )
|
||||
strings_displayed_in_iframe.append( '%s/view/user1/filtering_0420' % self.url )
|
||||
self.load_citable_url( username='user1',
|
||||
repository_name='filtering_0420',
|
||||
changeset_revision=None,
|
||||
encoded_user_id=encoded_user_id,
|
||||
encoded_repository_id=encoded_repository_id,
|
||||
strings_displayed=strings_displayed,
|
||||
strings_displayed_in_iframe=strings_displayed_in_iframe )
|
||||
def test_0025_load_view_page_for_previous_revision( self ):
|
||||
'''Load a citable url for a past changeset revision and verify that strings display.'''
|
||||
'''
|
||||
We are at step 5.
|
||||
Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/filtering_0420/<revision 0>
|
||||
Resulting page should not contain change set revision 1, but should contain change set revision 0.
|
||||
'''
|
||||
global first_changeset_hash
|
||||
repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
|
||||
test_user_1 = test_db_util.get_user( common.test_user_1_email )
|
||||
encoded_user_id = self.security.encode_id( test_user_1.id )
|
||||
encoded_repository_id = self.security.encode_id( repository.id )
|
||||
# We are checking the changeset revision pointed to by first_changeset_hash, stored in a global variable at the end of
|
||||
# test_0005. The tip changeset hash should not be displayed here, but first_changeset_hash should.
|
||||
tip_changeset_hash = self.get_repository_tip( repository )
|
||||
# Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
|
||||
# then directly load the url that the iframe should be loading and check for the expected strings.
|
||||
# The iframe should point to /repository/view_repository?id=<encoded repository ID>
|
||||
strings_displayed = [ '/repository', 'view_repository', 'id=' + encoded_repository_id ]
|
||||
strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420', first_changeset_hash ]
|
||||
strings_displayed_in_iframe.append( 'Sharable link to this repository revision:' )
|
||||
strings_displayed_in_iframe.append( '%s/view/user1/filtering_0420/%s' % ( self.url, first_changeset_hash ) )
|
||||
strings_not_displayed_in_iframe = [ tip_changeset_hash ]
|
||||
self.load_citable_url( username='user1',
|
||||
repository_name='filtering_0420',
|
||||
changeset_revision=first_changeset_hash,
|
||||
encoded_user_id=encoded_user_id,
|
||||
encoded_repository_id=encoded_repository_id,
|
||||
strings_displayed=strings_displayed,
|
||||
strings_displayed_in_iframe=strings_displayed_in_iframe,
|
||||
strings_not_displayed_in_iframe=strings_not_displayed_in_iframe )
|
||||
def test_0030_load_sharable_url_with_invalid_changeset_revision( self ):
|
||||
'''Load a citable url with an invalid changeset revision specified.'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
|
||||
test_user_1 = test_db_util.get_user( common.test_user_1_email )
|
||||
encoded_user_id = self.security.encode_id( test_user_1.id )
|
||||
encoded_repository_id = self.security.encode_id( repository.id )
|
||||
changeset_hash = '!!invalid!!'
|
||||
tip_revision = self.get_repository_tip( repository )
|
||||
# Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
|
||||
# then directly load the url that the iframe should be loading and check for the expected strings.
|
||||
# The iframe should point to /repository/view_repository?id=<encoded repository ID>&status=error
|
||||
strings_displayed = [ '/repository', 'view_repository', 'id=' + encoded_repository_id ]
|
||||
strings_displayed.extend( [ 'The+change+log', 'does+not+include+revision', '%21%21invalid%21%21', 'status=error' ] )
|
||||
strings_displayed_in_iframe = [ 'user1', 'filtering_0420', 'Galaxy filtering tool for test 0420' ]
|
||||
strings_displayed_in_iframe.append( 'Sharable link to this repository revision:' )
|
||||
strings_displayed_in_iframe.append( '%s/view/user1/filtering_0420/%s' % ( self.url, changeset_hash ) )
|
||||
strings_not_displayed_in_iframe = [ tip_revision ]
|
||||
self.load_citable_url( username='user1',
|
||||
repository_name='filtering_0420',
|
||||
changeset_revision=changeset_hash,
|
||||
encoded_user_id=encoded_user_id,
|
||||
encoded_repository_id=encoded_repository_id,
|
||||
strings_displayed=strings_displayed,
|
||||
strings_displayed_in_iframe=strings_displayed_in_iframe,
|
||||
strings_not_displayed_in_iframe=strings_not_displayed_in_iframe )
|
||||
def test_0035_load_sharable_url_with_invalid_repository_name( self ):
|
||||
'''Load a citable url with an invalid changeset revision specified.'''
|
||||
'''
|
||||
We are at step 7
|
||||
Visit the following url and check for appropriate strings: <tool shed base url>/view/user1/!!invalid!!
|
||||
'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name )
|
||||
test_user_1 = test_db_util.get_user( common.test_user_1_email )
|
||||
encoded_user_id = self.security.encode_id( test_user_1.id )
|
||||
tip_revision = self.get_repository_tip( repository )
|
||||
# Since twill does not load the contents of an iframe, we need to check that the iframe has been generated correctly,
|
||||
# then directly load the url that the iframe should be loading and check for the expected strings.
|
||||
# The iframe should point to /repository/browse_repositories?user_id=<encoded user ID>&operation=repositories_by_user
|
||||
strings_displayed = [ '/repository', 'browse_repositories', 'user1' ]
|
||||
strings_displayed.extend( [ 'list+of+repositories+owned', 'does+not+include+one+named', '%21%21invalid%21%21', 'status=error' ] )
|
||||
strings_displayed_in_iframe = [ 'user1', 'filtering_0420' ]
|
||||
strings_displayed_in_iframe.append( 'Repositories owned by user1' )
|
||||
strings_displayed_in_iframe.append( tip_revision )
|
||||
self.load_citable_url( username='user1',
|
||||
repository_name='!!invalid!!',
|
||||
changeset_revision=None,
|
||||
encoded_user_id=encoded_user_id,
|
||||
encoded_repository_id=None,
|
||||
strings_displayed=strings_displayed,
|
||||
strings_displayed_in_iframe=strings_displayed_in_iframe )
|
||||
def test_0040_load_sharable_url_with_invalid_owner( self ):
|
||||
'''Load a citable url with an invalid owner.'''
|
||||
'''
|
||||
We are at step 8.
|
||||
Visit the following url and check for appropriate strings: <tool shed base url>/view/!!invalid!!
|
||||
'''
|
||||
strings_displayed = [ 'The tool shed', self.url, 'contains no repositories owned by', '!!invalid!!' ]
|
||||
self.load_citable_url( username='!!invalid!!',
|
||||
repository_name=None,
|
||||
changeset_revision=None,
|
||||
encoded_user_id=None,
|
||||
encoded_repository_id=None,
|
||||
strings_displayed=strings_displayed )
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os
|
||||
import tool_shed.base.test_db_util as test_db_util
|
||||
|
||||
datatypes_repository_name = 'blast_datatypes_0120'
|
||||
datatypes_repository_description = 'Galaxy applicable datatypes for BLAST'
|
||||
datatypes_repository_long_description = 'Galaxy datatypes for the BLAST top hit descriptons tool'
|
||||
|
||||
tool_repository_name = 'blastxml_to_top_descr_0120'
|
||||
tool_repository_description = 'BLAST top hit descriptions'
|
||||
tool_repository_long_description = 'Make a table from BLAST XML'
|
||||
|
||||
'''
|
||||
Tool shed side:
|
||||
|
||||
1) Create and populate blast_datatypes_0120.
|
||||
1a) Check for appropriate strings.
|
||||
2) Create and populate blastxml_to_top_descr_0120.
|
||||
2a) Check for appropriate strings.
|
||||
3) Upload repository_dependencies.xml to blastxml_to_top_descr_0120 that defines a relationship to blast_datatypes_0120.
|
||||
3a) Check for appropriate strings.
|
||||
|
||||
|
||||
Galaxy side:
|
||||
|
||||
1) Install blastxml_to_top_descr_0120, with repository dependencies.
|
||||
1a) Check for appropriate strings in the installed blastxml_to_top_descr_0120 and blast_datatypes_0120 repositories.
|
||||
'''
|
||||
|
||||
running_standalone = False
|
||||
|
||||
class TestInstallRepositoryMultipleOwners( ShedTwillTestCase ):
|
||||
def test_0000_initiate_users( self ):
|
||||
"""Create necessary user accounts and login as an admin user."""
|
||||
"""
|
||||
Create all the user accounts that are needed for this test script to run independently of other tests.
|
||||
Previously created accounts will not be re-created.
|
||||
"""
|
||||
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 )
|
||||
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_1_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.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_datatypes_repository( self ):
|
||||
"""Create and populate the blast_datatypes_0120 repository"""
|
||||
"""
|
||||
We are at step 1.
|
||||
Create and populate blast_datatypes.
|
||||
"""
|
||||
category = self.create_category( name='Test 0120', description='Description of test 0120' )
|
||||
self.logout()
|
||||
self.login( email=common.test_user_2_email, username=common.test_user_2_name )
|
||||
strings_displayed = [ 'Repository %s' % "'%s'" % datatypes_repository_name,
|
||||
'Repository %s has been created' % "'%s'" % datatypes_repository_name ]
|
||||
repository = self.get_or_create_repository( name=datatypes_repository_name,
|
||||
description=datatypes_repository_description,
|
||||
long_description=datatypes_repository_long_description,
|
||||
owner=common.test_user_2_name,
|
||||
category_id=self.security.encode_id( category.id ),
|
||||
strings_displayed=strings_displayed )
|
||||
if self.repository_is_new( repository ):
|
||||
self.upload_file( repository,
|
||||
filename='blast/blast_datatypes.tar',
|
||||
filepath=None,
|
||||
valid_tools_only=True,
|
||||
uncompress_file=True,
|
||||
remove_repo_files_not_in_tar=False,
|
||||
commit_message='Uploaded blast_datatypes tarball.',
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[] )
|
||||
def test_0010_verify_datatypes_repository( self ):
|
||||
'''Verify the blast_datatypes_0120 repository.'''
|
||||
'''
|
||||
We are at step 1a.
|
||||
Check for appropriate strings, most importantly BlastXml, BlastNucDb, and BlastProtDb,
|
||||
the datatypes that are defined in datatypes_conf.xml.
|
||||
'''
|
||||
global repository_datatypes_count
|
||||
repository = test_db_util.get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
strings_displayed = [ 'BlastXml', 'BlastNucDb', 'BlastProtDb', 'application/xml', 'text/html', 'blastxml', 'blastdbn', 'blastdbp']
|
||||
self.display_manage_repository_page( repository, strings_displayed=strings_displayed )
|
||||
repository_datatypes_count = int( self.get_repository_datatypes_count( repository ) )
|
||||
def test_0015_create_tool_repository( self ):
|
||||
"""Create and populate the blastxml_to_top_descr_0120 repository"""
|
||||
"""
|
||||
We are at step 2.
|
||||
Create and populate blastxml_to_top_descr_0120.
|
||||
"""
|
||||
global running_standalone
|
||||
category = self.create_category( name='Test 0120', description='Description of test 0120' )
|
||||
self.logout()
|
||||
self.login( email=common.test_user_1_email, username=common.test_user_1_name )
|
||||
strings_displayed = [ 'Repository %s' % "'%s'" % tool_repository_name,
|
||||
'Repository %s has been created' % "'%s'" % tool_repository_name ]
|
||||
repository = self.get_or_create_repository( name=tool_repository_name,
|
||||
description=tool_repository_description,
|
||||
long_description=tool_repository_long_description,
|
||||
owner=common.test_user_1_name,
|
||||
category_id=self.security.encode_id( category.id ),
|
||||
strings_displayed=strings_displayed )
|
||||
if self.repository_is_new( repository ):
|
||||
running_standalone = True
|
||||
self.upload_file( repository,
|
||||
filename='blast/blastxml_to_top_descr.tar',
|
||||
filepath=None,
|
||||
valid_tools_only=True,
|
||||
uncompress_file=True,
|
||||
remove_repo_files_not_in_tar=False,
|
||||
commit_message='Uploaded blastxml_to_top_descr tarball.',
|
||||
strings_displayed=[],
|
||||
strings_not_displayed=[] )
|
||||
def test_0020_verify_tool_repository( self ):
|
||||
'''Verify the blastxml_to_top_descr_0120 repository.'''
|
||||
'''
|
||||
We are at step 2a.
|
||||
Check for appropriate strings, such as tool name, description, and version.
|
||||
'''
|
||||
repository = test_db_util.get_repository_by_name_and_owner( tool_repository_name, common.test_user_1_name )
|
||||
strings_displayed = [ 'blastxml_to_top_descr_0120', 'BLAST top hit descriptions', 'Make a table from BLAST XML' ]
|
||||
strings_displayed.extend( [ '0.0.1', 'Valid tools'] )
|
||||
self.display_manage_repository_page( repository, strings_displayed=strings_displayed )
|
||||
def test_0025_create_repository_dependency( self ):
|
||||
'''Create a repository dependency on blast_datatypes_0120.'''
|
||||
'''
|
||||
We are at step 3.
|
||||
Create a simple repository dependency for blastxml_to_top_descr_0120 that defines a dependency on blast_datatypes_0120.
|
||||
'''
|
||||
global running_standalone
|
||||
if running_standalone:
|
||||
datatypes_repository = test_db_util.get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
tool_repository = test_db_util.get_repository_by_name_and_owner( tool_repository_name, common.test_user_1_name )
|
||||
dependency_xml_path = self.generate_temp_path( 'test_1120', additional_paths=[ 'dependencies' ] )
|
||||
self.create_repository_dependency( repository=tool_repository, depends_on=[ datatypes_repository ], filepath=dependency_xml_path )
|
||||
def test_0040_verify_repository_dependency( self ):
|
||||
'''Verify the created repository dependency.'''
|
||||
'''
|
||||
We are at step 3a.
|
||||
Check the newly created repository dependency to ensure that it was defined and displays correctly.
|
||||
'''
|
||||
datatypes_repository = test_db_util.get_repository_by_name_and_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
tool_repository = test_db_util.get_repository_by_name_and_owner( tool_repository_name, common.test_user_1_name )
|
||||
self.check_repository_dependency( tool_repository, datatypes_repository )
|
||||
def test_0045_install_blastxml_to_top_descr( self ):
|
||||
'''Install the blastxml_to_top_descr_0120 repository to Galaxy.'''
|
||||
'''
|
||||
We are at step 1, Galaxy side.
|
||||
Install blastxml_to_top_descr_0120 to Galaxy, with repository dependencies, so that the datatypes repository is also installed.
|
||||
'''
|
||||
global base_datatypes_count
|
||||
self.galaxy_logout()
|
||||
self.galaxy_login( email=common.admin_email, username=common.admin_username )
|
||||
base_datatypes_count = int( self.get_datatypes_count() )
|
||||
post_submit_strings_displayed = [ 'blastxml_to_top_descr_0120', 'blast_datatypes_0120', 'New' ]
|
||||
self.install_repository( name='blastxml_to_top_descr_0120',
|
||||
owner=common.test_user_1_name,
|
||||
category_name='Test 0120',
|
||||
install_repository_dependencies=True,
|
||||
post_submit_strings_displayed=post_submit_strings_displayed,
|
||||
new_tool_panel_section='Test 0120' )
|
||||
def test_0050_verify_repository_installation( self ):
|
||||
'''Verify installation of blastxml_to_top_descr_0120 and blast_datatypes_0120.'''
|
||||
'''
|
||||
We are at step 1a, Galaxy side.
|
||||
Check that the blastxml_to_top_descr_0120 and blast_datatypes_0120 repositories installed correctly, and that there
|
||||
are now new datatypes in the registry matching the ones defined in blast_datatypes_0120. Also check that
|
||||
blast_datatypes_0120 is labeled as an installed repository dependency of blastxml_to_top_descr_0120.
|
||||
'''
|
||||
global repository_datatypes_count
|
||||
global base_datatypes_count
|
||||
tool_repository = test_db_util.get_installed_repository_by_name_owner( tool_repository_name, common.test_user_1_name )
|
||||
datatypes_repository = test_db_util.get_installed_repository_by_name_owner( datatypes_repository_name, common.test_user_2_name )
|
||||
current_datatypes = int( self.get_datatypes_count() )
|
||||
expected_count = base_datatypes_count + repository_datatypes_count
|
||||
assert current_datatypes == expected_count, 'Installing %s did not add new datatypes. Expected: %d. Found: %d' % \
|
||||
( 'blastxml_to_top_descr_0120', expected_count, current_datatypes )
|
||||
strings_displayed = [ 'Installed repository dependencies', 'user1', 'blast_datatypes_0120' ]
|
||||
strings_displayed.extend( [ 'Valid tools', 'BLAST top hit', 'Make a table', datatypes_repository.installed_changeset_revision ] )
|
||||
self.display_installed_repository_manage_page( tool_repository, strings_displayed=strings_displayed )
|
||||
strings_displayed = [ 'Datatypes', 'blastxml', 'blastdbp', 'blastdbn', 'BlastXml', 'BlastNucDb', 'BlastProtDb' ]
|
||||
strings_displayed.extend( [ 'application/xml', 'text/html' ] )
|
||||
self.display_installed_repository_manage_page( datatypes_repository, strings_displayed=strings_displayed )
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user