mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-08-30 16:58:03 +08:00
Moved API tests to live under test/ rather than test/functional/. Removed test for DNAse flanked genes. Added test for UCSC table browser.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
from galaxy.exceptions import error_codes
|
||||
from functional.api.test_pages import BasePageApiTestCase
|
||||
from api.test_pages import BasePageApiTestCase
|
||||
|
||||
|
||||
class PageRevisionsApiTestCase( BasePageApiTestCase ):
|
||||
@@ -1074,7 +1074,7 @@ class TwillTestCase( unittest.TestCase ):
|
||||
# HACK: don't use panels because late_javascripts() messes up the twill browser and it
|
||||
# can't find form fields (and hence user can't be logged in).
|
||||
self.visit_url( "/user/login?use_panels=False" )
|
||||
self.submit_form( 1, 'login_button', email=email, redirect=redirect, password=password )
|
||||
self.submit_form( 'login', 'login_button', email=email, redirect=redirect, password=password )
|
||||
|
||||
def logout( self ):
|
||||
self.visit_url( "%s/user/logout" % self.url )
|
||||
@@ -1143,6 +1143,9 @@ class TwillTestCase( unittest.TestCase ):
|
||||
def last_page( self ):
|
||||
return tc.browser.get_html()
|
||||
|
||||
def last_url( self ):
|
||||
return tc.browser.get_url()
|
||||
|
||||
def load_cookies( self, file, shed_tool_id=None ):
|
||||
filename = self.get_filename( file, shed_tool_id=shed_tool_id )
|
||||
tc.load_cookies(filename)
|
||||
@@ -1350,13 +1353,25 @@ class TwillTestCase( unittest.TestCase ):
|
||||
def run_ucsc_main( self, track_params, output_params ):
|
||||
"""Gets Data From UCSC"""
|
||||
tool_id = "ucsc_table_direct1"
|
||||
galaxy_url = urllib.quote_plus( "%s/tool_runner/index?" % self.url )
|
||||
galaxy_url = "%s/tool_runner/index?" % self.url
|
||||
track_params.update( dict( GALAXY_URL=galaxy_url, hgta_compressType='none', tool_id=tool_id ) )
|
||||
self.visit_url( "http://genome.ucsc.edu/cgi-bin/hgTables", params=track_params )
|
||||
tc.fv( "mainForm", "hgta_doTopSubmit", "get output" )
|
||||
self.submit_form( button="get output" )
|
||||
tc.fv( 2, "hgta_doGalaxyQuery", "Send query to Galaxy" )
|
||||
self.submit_form( button="Send query to Galaxy" )
|
||||
log.debug( 'Last URL: %s', self.last_url() )
|
||||
tc.fv( 'mainForm', 'checkboxGalaxy', 'on' )
|
||||
tc.submit( 'hgta_doTopSubmit' )
|
||||
log.debug( 'Last URL: %s', self.last_url() )
|
||||
tc.fv( 2, "hgta_geneSeqType", "genomic" )
|
||||
tc.submit( 'hgta_doGenePredSequence' )
|
||||
log.debug( 'Last URL: %s', self.last_url() )
|
||||
# log.debug( self.last_page() )
|
||||
for index, form in enumerate( self.showforms() ):
|
||||
log.debug( 'Form #%s: %s', index, form.name )
|
||||
log.debug( 'Form target: %s', form.action )
|
||||
for control_num, control in enumerate( form.controls ):
|
||||
log.debug( '%s: %s', control.name, control.value )
|
||||
tc.fv( 2, 'hgSeq.casing', 'upper' )
|
||||
log.debug( tc.submit( 'hgta_doGalaxyQuery' ) )
|
||||
log.debug( 'Last URL: %s', self.last_url() )
|
||||
|
||||
def get_running_datasets( self ):
|
||||
self.visit_url( '/api/histories' )
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
import galaxy.model
|
||||
from galaxy.model.orm import *
|
||||
import database_contexts
|
||||
from base.twilltestcase import TwillTestCase
|
||||
|
||||
""" A sample analysis"""
|
||||
|
||||
|
||||
class AnalysisDNAseHSSFlankedGenes( TwillTestCase ):
|
||||
|
||||
def test_get_DNAseHSS_flanked_genes( self ):
|
||||
sa_session = database_contexts.galaxy_context
|
||||
self.logout()
|
||||
self.login( email='test@bx.psu.edu' )
|
||||
admin_user = sa_session.query( galaxy.model.User ) \
|
||||
.filter( galaxy.model.User.table.c.email == 'test@bx.psu.edu' ) \
|
||||
.one()
|
||||
self.new_history( name='DNAseHSS_flanked_genes' )
|
||||
history1 = 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 ) ) \
|
||||
.order_by( desc( galaxy.model.History.table.c.create_time ) ) \
|
||||
.first()
|
||||
track_params = dict(
|
||||
db="hg17",
|
||||
hgta_group="regulation",
|
||||
hgta_table="dukeDnaseCd4Sites",
|
||||
hgta_track="dukeDnaseCd4Sites",
|
||||
hgta_regionType="range",
|
||||
position="chr22",
|
||||
hgta_outputType="bed",
|
||||
sendToGalaxy="1"
|
||||
)
|
||||
output_params = dict(
|
||||
fbQual="whole",
|
||||
)
|
||||
# Test 1
|
||||
self.run_ucsc_main( track_params, output_params )
|
||||
self.wait()
|
||||
self.verify_dataset_correctness('DNAseHSS.dat')
|
||||
latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
|
||||
.order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
|
||||
.first()
|
||||
# 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.
|
||||
for dp in latest_hda.dataset.actions:
|
||||
sa_session.delete( dp )
|
||||
sa_session.flush()
|
||||
sa_session.refresh( latest_hda.dataset )
|
||||
self.edit_hda_attribute_info( str( latest_hda.id ), new_name="DNAse HS" )
|
||||
self.check_metadata_for_string( "DNAse HS" )
|
||||
track_params = dict(
|
||||
db="hg17",
|
||||
hgta_group="genes",
|
||||
hgta_table="knownGene",
|
||||
hgta_track="knownGene",
|
||||
hgta_regionType="range",
|
||||
position="chr22",
|
||||
hgta_outputType="bed",
|
||||
sendToGalaxy="1"
|
||||
)
|
||||
output_params = dict(
|
||||
fbQual="whole",
|
||||
)
|
||||
# Test 2
|
||||
self.run_ucsc_main( track_params, output_params )
|
||||
self.wait()
|
||||
self.verify_dataset_correctness('hg17chr22KnownGenes.dat')
|
||||
latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
|
||||
.order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
|
||||
.first()
|
||||
for dp in latest_hda.dataset.actions:
|
||||
sa_session.delete( dp )
|
||||
sa_session.flush()
|
||||
sa_session.refresh( latest_hda.dataset )
|
||||
self.edit_hda_attribute_info( str( latest_hda.id ), new_name="Genes" )
|
||||
self.check_metadata_for_string( "Genes" )
|
||||
# Test 3
|
||||
self.run_tool( 'get_flanks1', input="2", region="whole", direction="Upstream", offset="0", size="500" )
|
||||
self.wait()
|
||||
self.verify_dataset_correctness( 'knownGeneUpstream500Flanks.dat' )
|
||||
latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
|
||||
.order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
|
||||
.first()
|
||||
for dp in latest_hda.dataset.actions:
|
||||
sa_session.delete( dp )
|
||||
sa_session.flush()
|
||||
sa_session.refresh( latest_hda.dataset )
|
||||
self.edit_hda_attribute_info( str( latest_hda.id ), new_name="Flanks" )
|
||||
self.check_metadata_for_string( "Flanks" )
|
||||
# Test 4
|
||||
self.run_tool( 'gops_join_1', input1="3", input2="1", min="1", fill="none" )
|
||||
self.wait()
|
||||
# We cannot verify this dataset, because this tool spits out data in a non-deterministic order
|
||||
#self.verify_dataset_correctness( 'joinFlanksDNAse.dat' )
|
||||
# Test 5
|
||||
self.run_tool( 'Filter1', input="4", cond="c17==1000" )
|
||||
self.wait()
|
||||
self.verify_dataset_correctness( 'filteredJoinedFlanksDNAse.dat' )
|
||||
self.delete_history( self.security.encode_id( history1.id ) )
|
||||
self.logout()
|
||||
@@ -0,0 +1,35 @@
|
||||
from base import test_db_util
|
||||
from base.twilltestcase import TwillTestCase
|
||||
|
||||
""" A sample analysis"""
|
||||
|
||||
|
||||
class UCSCMain( TwillTestCase ):
|
||||
|
||||
def test_0000_create_users( self ):
|
||||
self.logout()
|
||||
self.login( email='test@bx.psu.edu' )
|
||||
admin_user = test_db_util.get_user( 'test@bx.psu.edu' )
|
||||
assert admin_user is not None, 'Problem retrieving user with email "test@bx.psu.edu" from the database'
|
||||
|
||||
def test_0005_get_mm10_5HTT_sequence( self ):
|
||||
self.logout()
|
||||
self.login( email='test@bx.psu.edu' )
|
||||
admin_user = test_db_util.get_user( 'test@bx.psu.edu' )
|
||||
self.new_history( name='UCSC_Main' )
|
||||
track_params = dict(
|
||||
db="mm10",
|
||||
hgta_group="genes",
|
||||
hgta_table="knownGene",
|
||||
hgta_track="knownGene",
|
||||
hgta_regionType="range",
|
||||
position="chr5:34761740-34912521",
|
||||
hgta_outputType="sequence",
|
||||
sendToGalaxy="1"
|
||||
)
|
||||
output_params = dict(
|
||||
fbQual="whole",
|
||||
)
|
||||
self.run_ucsc_main( track_params, output_params )
|
||||
self.wait()
|
||||
self.verify_dataset_correctness( 'GRCm38mm10_chr5_34761740-34912521.fa' )
|
||||
Reference in New Issue
Block a user