mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Twill test framework cleanup. Update install and test methods to reflect changes in base twilltestcase.py.
This commit is contained in:
@@ -1769,10 +1769,11 @@ class TwillTestCase( unittest.TestCase ):
|
||||
tc.submit( "edit_external_service_button" )
|
||||
for check_str in strings_displayed_after_submit:
|
||||
self.check_page_for_string( check_str )
|
||||
|
||||
# Sample tracking stuff
|
||||
def check_request_grid( self, cntrller, state, deleted=False, strings_displayed=[] ):
|
||||
self.visit_url( '%s/%s/browse_requests?sort=create_time&f-state=%s&f-deleted=%s' % \
|
||||
( self.url, cntrller, state.replace( ' ', '+' ), str( deleted ) ) )
|
||||
params = { 'f-state': state, 'f-deleted': deleted, 'sort': 'create_time' }
|
||||
self.visit_url( '/%s/browse_requests' % cntrller )
|
||||
for check_str in strings_displayed:
|
||||
self.check_page_for_string( check_str )
|
||||
def create_request_type( self, name, desc, request_form_id, sample_form_id, states, strings_displayed=[], strings_displayed_after_submit=[] ):
|
||||
@@ -1967,8 +1968,8 @@ class TwillTestCase( unittest.TestCase ):
|
||||
for check_str in strings_displayed:
|
||||
self.check_page_for_string( check_str )
|
||||
for sample_id in sample_ids:
|
||||
tc.fv( "1", "select_sample_%i" % sample_id, True )
|
||||
tc.fv( "1", "sample_operation", 'Select data library and folder' )
|
||||
tc.fv( "edit_samples", "select_sample_%i" % sample_id, True )
|
||||
tc.fv( "edit_samples", "sample_operation", 'Select data library and folder' )
|
||||
# refresh on change to show the data libraries selectfield
|
||||
self.refresh_form( "sample_operation", 'Select data library and folder' )
|
||||
self.check_page_for_string( "Select data library:" )
|
||||
|
||||
@@ -3,7 +3,6 @@ import os
|
||||
import re
|
||||
import test_db_util
|
||||
import time
|
||||
import urllib
|
||||
|
||||
import galaxy.model as model
|
||||
import galaxy.model.tool_shed_install as install_model
|
||||
@@ -72,22 +71,22 @@ class InstallTestRepository( TwillTestCase ):
|
||||
encoded_repository_id = repository_info_dict[ 'repository_id' ]
|
||||
tool_shed_url = repository_info_dict[ 'tool_shed_url' ]
|
||||
# Pass galaxy_url to the tool shed in order to set cookies and redirects correctly.
|
||||
install_params = urllib.urlencode( dict( repository_ids=encoded_repository_id,
|
||||
changeset_revisions=changeset_revision,
|
||||
galaxy_url=self.url ) )
|
||||
install_params = dict( repository_ids=encoded_repository_id,
|
||||
changeset_revisions=changeset_revision,
|
||||
galaxy_url=self.url )
|
||||
# If the tool shed does not have the same hostname as the Galaxy server being used for these tests,
|
||||
# twill will not carry over previously set cookies for the Galaxy server when following the
|
||||
# install_repositories_by_revision redirect, so we have to include 403 in the allowed HTTP
|
||||
# status codes and log in again.
|
||||
url = '%s/repository/install_repositories_by_revision?%s' % ( tool_shed_url, install_params )
|
||||
self.visit_url( url, allowed_codes=[ 200, 403 ] )
|
||||
url = '%s/repository/install_repositories_by_revision' % tool_shed_url
|
||||
self.visit_url( url, params=install_params, allowed_codes=[ 200, 403 ] )
|
||||
self.logout()
|
||||
self.login( email='test@bx.psu.edu', username='test' )
|
||||
install_params = urllib.urlencode( dict( repository_ids=encoded_repository_id,
|
||||
changeset_revisions=changeset_revision,
|
||||
tool_shed_url=tool_shed_url ) )
|
||||
url = '/admin_toolshed/prepare_for_install?%s' % install_params
|
||||
self.visit_url( url )
|
||||
install_params = dict( repository_ids=encoded_repository_id,
|
||||
changeset_revisions=changeset_revision,
|
||||
tool_shed_url=tool_shed_url )
|
||||
url = '/admin_toolshed/prepare_for_install'
|
||||
self.visit_url( url, params=install_params )
|
||||
# This section is tricky, due to the way twill handles form submission. The tool dependency checkbox needs to
|
||||
# be hacked in through tc.browser, putting the form field in kwd doesn't work.
|
||||
form = tc.browser.get_form( 'select_tool_panel_section' )
|
||||
@@ -124,13 +123,6 @@ class InstallTestRepository( TwillTestCase ):
|
||||
del( kwd[ field_name ] )
|
||||
return kwd
|
||||
|
||||
def visit_url( self, url, allowed_codes=[ 200 ] ):
|
||||
new_url = tc.go( url )
|
||||
return_code = tc.browser.get_code()
|
||||
assert return_code in allowed_codes, 'Invalid HTTP return code %s, allowed codes: %s' % \
|
||||
( return_code, ', '.join( str( code ) for code in allowed_codes ) )
|
||||
return new_url
|
||||
|
||||
def wait_for_repository_installation( self, repository_ids ):
|
||||
final_states = [ install_model.ToolShedRepository.installation_status.ERROR,
|
||||
install_model.ToolShedRepository.installation_status.INSTALLED ]
|
||||
|
||||
Reference in New Issue
Block a user