Twill test framework cleanup. Fix functional tests for history functions.

This commit is contained in:
Dave Bouvier
2014-04-23 16:46:14 -04:00
parent f37dd1a769
commit 83394adf1b
6 changed files with 141 additions and 259 deletions
+130 -237
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -232,7 +232,6 @@ class TestDataSecurity( TwillTestCase ):
# Rename the group
rename = "Group One's been Renamed"
self.rename_group( self.security.encode_id( group_one.id ), name=rename, )
self.home()
self.visit_url( '%s/admin/groups' % self.url )
self.check_page_for_string( rename )
# Reset the group back to the original name
@@ -365,7 +364,6 @@ class TestDataSecurity( TwillTestCase ):
def test_065_mark_role_deleted( self ):
"""Testing marking a role as deleted"""
# Logged in as admin_user
self.home()
self.browse_roles( strings_displayed=[ role_two.name ] )
self.mark_role_deleted( self.security.encode_id( role_two.id ), role_two.name )
refresh( role_two )
+11 -15
View File
@@ -1,4 +1,3 @@
import urllib
import galaxy.model
from galaxy.model.orm import *
from base.test_db_util import sa_session
@@ -109,7 +108,7 @@ class TestHistory( TwillTestCase ):
.first()
assert history1 is not None, "Problem retrieving history1 from database"
self.upload_file( '1.bed', dbkey='hg18' )
self.new_history( name=urllib.quote( 'history2' ) )
self.new_history( name='history2' )
global history2
history2 = sa_session.query( galaxy.model.History ) \
.filter( and_( galaxy.model.History.table.c.deleted == False,
@@ -158,7 +157,7 @@ class TestHistory( TwillTestCase ):
assert history3 is not None, "Problem retrieving history3 from database"
if history3.deleted:
raise AssertionError( "History id %d deleted when it should not be" % latest_history.id )
self.rename_history( self.security.encode_id( history3.id ), history3.name, new_name=urllib.quote( 'history 3' ) )
self.rename_history( self.security.encode_id( history3.id ), history3.name, new_name='history 3' )
sa_session.refresh( history3 )
def test_015_history_list( self ):
@@ -348,7 +347,7 @@ class TestHistory( TwillTestCase ):
.order_by( desc( galaxy.model.History.table.c.create_time ) ) \
.first()
assert history4 is not None, "Problem retrieving history4 from database"
self.rename_history( self.security.encode_id( history4.id ), history4.name, new_name=urllib.quote( 'history 4' ) )
self.rename_history( self.security.encode_id( history4.id ), history4.name, new_name='history 4' )
sa_session.refresh( history4 )
# Galaxy's new history sharing code does not yet support sharing multiple histories; when support for sharing multiple histories is added,
# this test will be uncommented and updated.
@@ -383,7 +382,7 @@ class TestHistory( TwillTestCase ):
.order_by( desc( galaxy.model.History.table.c.create_time ) ) \
.first()
assert history5 is not None, "Problem retrieving history5 from database"
self.rename_history( self.security.encode_id( history5.id ), history5.name, new_name=urllib.quote( 'history 5' ) )
self.rename_history( self.security.encode_id( history5.id ), history5.name, new_name='history 5' )
# Current history is history5
sa_session.refresh( history5 )
# Due to the limitations of twill ( not functional with the permissions forms ), we're forced
@@ -547,7 +546,7 @@ class TestHistory( TwillTestCase ):
# Make sure the history was unshared correctly
self.logout()
self.login( email=regular_user2.email )
self.visit_page( "root/history_options" )
self.visit_url( "/root/history_options" )
try:
self.check_page_for_string( 'List</a> histories shared with you by others' )
raise AssertionError( "history5 still shared with regular_user2 after unsharing it with that user." )
@@ -695,7 +694,7 @@ class TestHistory( TwillTestCase ):
# Make sure the histories were unshared correctly
self.logout()
self.login( email=regular_user2.email )
self.visit_page( "root/history_options" )
self.visit_url( "/root/history_options" )
try:
self.check_page_for_string( 'List</a> histories shared with you by others' )
raise AssertionError( "history5 still shared with regular_user2 after unshaing it with that user." )
@@ -704,7 +703,7 @@ class TestHistory( TwillTestCase ):
self.logout()
self.login( email=regular_user3.email )
self.visit_page( "root/history_options" )
self.visit_url( "/root/history_options" )
try:
self.check_page_for_string( 'List</a> histories shared with you by others' )
raise AssertionError( "history5 still shared with regular_user3 after unshaing it with that user." )
@@ -724,7 +723,7 @@ class TestHistory( TwillTestCase ):
# Logged in as admin_user
# create a new history and upload a new hda (1.bed) into it
self.new_history( name=urllib.quote( 'show hide deleted datasets' ) )
self.new_history( name='show hide deleted datasets' )
latest_history = (
sa_session.query( galaxy.model.History )
.filter( and_( galaxy.model.History.table.c.deleted == False,
@@ -739,7 +738,6 @@ class TestHistory( TwillTestCase ):
.first() )
# delete that item and make sure the history is not empty
self.home()
log.info( 'deleting last hda' )
self.delete_history_item( str( latest_hda.id ) )
# check the number of items returned from the api
@@ -776,13 +774,12 @@ class TestHistory( TwillTestCase ):
assert latest_history is not None, "Problem retrieving latest_history from database"
self.rename_history( self.security.encode_id( latest_history.id ),
latest_history.name, new_name=urllib.quote( 'delete undelete history items' ) )
latest_history.name, new_name='delete undelete history items' )
# Add a new history item
self.upload_file( '1.bed', dbkey='hg15' )
latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
.order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
.first()
self.home()
self.visit_url( "%s/history/?show_deleted=False" % self.url )
self.check_page_for_string( '1.bed' )
self.check_page_for_string( 'hg15' )
@@ -798,7 +795,6 @@ class TestHistory( TwillTestCase ):
pass
# Undelete the history item
self.undelete_history_item( str( latest_hda.id ) )
self.home()
self.visit_url( "%s/history/?show_deleted=False" % self.url )
self.check_page_for_string( '1.bed' )
self.check_page_for_string( 'hg15' )
@@ -807,7 +803,7 @@ class TestHistory( TwillTestCase ):
def test_080_copying_history_items_between_histories( self ):
"""Testing copying history items between histories"""
# logged in as admin_user
self.new_history( name=urllib.quote( 'copy history items' ) )
self.new_history( name='copy history items' )
history6 = sa_session.query( galaxy.model.History ) \
.filter( and_( galaxy.model.History.table.c.deleted == False,
galaxy.model.History.table.c.user_id == admin_user.id ) ) \
@@ -836,7 +832,7 @@ class TestHistory( TwillTestCase ):
if len( history6.datasets ) != 2:
raise AssertionError( "Copying hda1 to the current history failed, history 6 has %d datasets, but should have 2" % len( history6.datasets ) )
# Test copying 1 hda to another history
self.new_history( name=urllib.quote( 'copy history items - 2' ) )
self.new_history( name='copy history items - 2' )
history7 = sa_session.query( galaxy.model.History ) \
.filter( and_( galaxy.model.History.table.c.deleted == False,
galaxy.model.History.table.c.user_id == admin_user.id ) ) \
-1
View File
@@ -27,7 +27,6 @@ class TestMetadataEdit( TwillTestCase ):
latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
.order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
.first()
self.home()
# Due to twill not being able to handle the permissions forms, we'll eliminate
# DefaultHistoryPermissions prior to uploading a dataset so that the permission
# form will not be displayed on ted edit attributes page.
@@ -39,7 +39,6 @@ class InstallTestRepository( TwillTestCase ):
# TODO: Figure out a way to alter these attributes during tests.
self.galaxy_tool_dependency_dir = os.environ.get( 'GALAXY_INSTALL_TEST_TOOL_DEPENDENCY_DIR' )
self.shed_tools_dict = {}
self.home()
def initiate_installation_process( self, install_tool_dependencies=False, install_repository_dependencies=True, no_changes=True,
new_tool_panel_section_label=None ):
-3
View File
@@ -61,7 +61,6 @@ class ShedTwillTestCase( TwillTestCase ):
# TODO: Figure out a way to alter these attributes during tests.
self.galaxy_tool_dependency_dir = os.environ.get( 'GALAXY_TEST_TOOL_DEPENDENCY_DIR' )
self.shed_tools_dict = {}
self.home()
def add_repository_review_component( self, **kwd ):
url = '/repository_review/create_component?operation=create'
@@ -597,10 +596,8 @@ class ShedTwillTestCase( TwillTestCase ):
self.submit_form( '1', 'login_button', email=email, redirect=redirect, password=password )
def galaxy_logout( self ):
self.home()
self.visit_galaxy_url( "/user/logout" )
self.check_page_for_string( "You have been logged out" )
self.home()
def generate_complex_dependency_xml( self, filename, filepath, repository_tuples, package, version ):
file_path = os.path.join( filepath, filename )