Ejemplo n.º 1
0
 def test_0095_upload_file(self):
     """Test uploading 3.maf, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('3.maf')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('3.maf', hid=str(hda.hid))
     self.check_history_for_string(
         '3.maf format: <span class="maf">maf</span>, database: \? Info: uploaded file'
     )
     self.check_metadata_for_string('value="3.maf" value="\?"')
     self.check_metadata_for_string(
         'Convert to new format <option value="interval">Convert MAF to Genomic Intervals <option value="fasta">Convert MAF to Fasta'
     )
     self.check_metadata_for_string(
         'Change data type selected value="maf" selected="yes"')
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 2
0
 def test_0060_upload_file(self):
     """Test uploading pbed composite datatype file, manually setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     # pbed data types include a bim_file, a bed_file and a fam_file
     self.upload_composite_datatype_file('pbed',
                                         bim_file='tinywga.bim',
                                         bed_file='tinywga.bed',
                                         fam_file='tinywga.fam',
                                         base_name='rgenetics')
     # Get the latest hid for testing
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     # We'll test against the resulting ped file and map file for correctness
     self.verify_composite_datatype_file_content('rgenetics.bim',
                                                 str(hda.id))
     self.verify_composite_datatype_file_content('rgenetics.bed',
                                                 str(hda.id))
     self.verify_composite_datatype_file_content('rgenetics.fam',
                                                 str(hda.id))
     self.check_history_for_string("Uploaded Composite Dataset (pbed)")
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 3
0
 def test_0105_upload_file(self):
     """Test uploading 1.interval, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('1.interval')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('1.interval', hid=str(hda.hid))
     self.check_history_for_string(
         '1.interval format: <span class="interval">interval</span>, database: \? Info: uploaded file'
     )
     self.check_metadata_for_string('value="1.interval" value="\?"')
     self.check_metadata_for_string(
         'Chrom column: <option value="1" selected> Start column: <option value="2" selected>'
     )
     self.check_metadata_for_string(
         'End column: <option value="3" selected> Strand column <option value="6" selected>'
     )
     self.check_metadata_for_string(
         'Convert to new format <option value="bed">Convert Genomic Intervals To BED'
     )
     self.check_metadata_for_string(
         'Change data type selected value="interval" selected="yes"')
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 4
0
 def test_070_history_show_and_hide_deleted_datasets(self):
     """Testing displaying deleted history items"""
     # Logged in as admin_user
     self.new_history(name=urllib.quote("show hide deleted datasets"))
     latest_history = (
         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()
     )
     assert latest_history is not None, "Problem retrieving latest_history from database"
     self.upload_file("1.bed", dbkey="hg18")
     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/root/delete?show_deleted_on_refresh=False&id=%s" % (self.url, str(latest_hda.id)))
     self.check_history_for_string("Your history is empty")
     self.home()
     self.visit_url("%s/history/?show_deleted=True" % self.url)
     self.check_page_for_string("This dataset has been deleted.")
     self.check_page_for_string("1.bed")
     self.home()
     self.visit_url("%s/history/?show_deleted=False" % self.url)
     self.check_page_for_string("Your history is empty")
     self.delete_history(self.security.encode_id(latest_history.id))
def get_all_installed_repositories( actually_installed=False ):
    if actually_installed:
        return ga_session.query( galaxy.model.ToolShedRepository ) \
                         .filter( and_( galaxy.model.ToolShedRepository.table.c.deleted == False,
                                        galaxy.model.ToolShedRepository.table.c.uninstalled == False,
                                        galaxy.model.ToolShedRepository.table.c.status == galaxy.model.ToolShedRepository.installation_status.INSTALLED ) ) \
                         .all()
    else:
        return ga_session.query( galaxy.model.ToolShedRepository ).all()
Ejemplo n.º 6
0
 def do_it( self, testdef ):
     # If the test generation had an error, raise
     if testdef.error:
         if testdef.exception:
             raise testdef.exception
         else:
             raise Exception( "Test parse failure" )
     # Start with a new history
     self.logout()
     self.login( email='*****@*****.**' )
     admin_user = sa_session.query( galaxy.model.User ).filter( galaxy.model.User.table.c.email=='*****@*****.**' ).one()
     self.new_history()
     latest_history = 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()
     assert latest_history is not None, "Problem retrieving latest_history from database"
     if len( self.get_history_as_data_list() ) > 0:
         raise AssertionError("ToolTestCase.do_it failed")
     # Upload any needed files
     for fname, extra in testdef.required_files:
         self.upload_file( fname, ftype=extra.get( 'ftype', 'auto' ), dbkey=extra.get( 'dbkey', 'hg17' ) )
         print "Uploaded file: ", fname, ", ftype: ", extra.get( 'ftype', 'auto' ), ", extra: ", extra
     # We need to handle the case where we've uploaded a valid compressed file since the upload
     # tool will have uncompressed it on the fly.
     all_inputs = {}
     for name, value, _ in testdef.inputs:
         if value:
             for end in [ '.zip', '.gz' ]:
                 if value.endswith( end ):
                     value = value.rstrip( end )
                     break
         all_inputs[ name ] = value
     # See if we have a grouping.Repeat element
     repeat_name = None
     for input_name, input_value in testdef.tool.inputs_by_page[0].items():
         if isinstance( input_value, grouping.Repeat ):
             repeat_name = input_name
             break
     # Do the first page
     page_inputs =  self.__expand_grouping(testdef.tool.inputs_by_page[0], all_inputs)
     # Run the tool
     self.run_tool( testdef.tool.id, repeat_name=repeat_name, **page_inputs )
     print "page_inputs (0)", page_inputs
     # Do other pages if they exist
     for i in range( 1, testdef.tool.npages ):
         page_inputs = self.__expand_grouping(testdef.tool.inputs_by_page[i], all_inputs)
         self.submit_form( **page_inputs )
         print "page_inputs (%i)" % i, page_inputs
     # Check the result
     assert len( testdef.outputs ) == 1, "ToolTestCase does not deal with multiple outputs properly yet."
     for name, file in testdef.outputs:
         self.verify_dataset_correctness( file, maxseconds=testdef.maxseconds )
     self.delete_history( id=self.security.encode_id( latest_history.id ) )
Ejemplo n.º 7
0
 def test_00_metadata_edit(self):
     """test_metadata_edit: Testing metadata editing"""
     self.logout()
     self.login(email='*****@*****.**', username='******')
     admin_user = sa_session.query( galaxy.model.User ) \
                           .filter( galaxy.model.User.table.c.email=='*****@*****.**' ) \
                           .one()
     self.new_history(name='Test Metadata Edit')
     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()
     self.upload_file('1.bed')
     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.
     for dp in latest_hda.dataset.actions:
         sa_session.delete(dp)
         sa_session.flush()
     sa_session.refresh(latest_hda.dataset)
     self.check_history_for_string('1.bed')
     self.check_metadata_for_string(
         '1.bed uploaded file unspecified (\?) chromCol value="1" selected endCol value="3" is_strandCol value="true" checked',
         hid=str(latest_hda.hid))
     """test editing attributes"""
     self.edit_hda_attribute_info(hda_id=str(latest_hda.id),
                                  new_name='Testdata',
                                  new_info="Uploaded my file",
                                  new_dbkey='hg16',
                                  new_startcol='6')
     self.check_metadata_for_string(
         'Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="6" selected',
         hid=str(latest_hda.hid))
     """test Auto-detecting attributes"""
     self.auto_detect_metadata(hda_id=str(latest_hda.id))
     self.check_metadata_for_string(
         'Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="2" selected',
         hid=str(latest_hda.hid))
     """test converting formats"""
     self.convert_format(hda_id=str(latest_hda.id), target_type='gff')
     self.check_metadata_for_string('"gff" selected="yes"',
                                    hid=str(latest_hda.hid))
     """test changing data type"""
     self.change_datatype(hda_id=str(latest_hda.id), datatype='gff3')
     self.check_metadata_for_string('gff3', hid=str(latest_hda.hid))
     self.delete_history(id=self.security.encode_id(history1.id))
     self.logout()
Ejemplo n.º 8
0
 def test_0050_upload_file( self ):
     """Test uploading 454Score.png, NOT setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '454Score.png' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string( "The uploaded file contains inappropriate content" )
Ejemplo n.º 9
0
 def test_0050_upload_file(self):
     """Test uploading 454Score.png, NOT setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('454Score.png')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string(
         "The uploaded file contains inappropriate content")
Ejemplo n.º 10
0
 def test_0030_upload_file( self ):
     """Test uploading 1.scf.zip, NOT setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '1.scf.zip' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string( "'File Format' for archive consisting of binary files - use 'Binseq.zip'" )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 11
0
 def test_075_deleting_and_undeleting_history_items(self):
     """Testing deleting and un-deleting history items"""
     # logged in as admin_user
     # Deleting the current history in the last method created a new history
     latest_history = (
         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()
     )
     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"),
     )
     # 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")
     self.assertEqual(len(self.get_history_as_data_list()), 1)
     # Delete the history item
     self.delete_history_item(str(latest_hda.id), check_str="Your history is empty")
     self.assertEqual(len(self.get_history_as_data_list()), 0)
     # Try deleting an invalid hid
     try:
         self.delete_history_item("XXX")
         raise AssertionError, "Inproperly able to delete hda_id 'XXX' which is not an integer"
     except:
         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")
     self.delete_history(self.security.encode_id(latest_history.id))
Ejemplo n.º 12
0
 def test_0140_upload_file( self ):
     """Test uploading megablast_xml_parser_test1.gz, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( 'megablast_xml_parser_test1.gz' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string( 'NCBI Blast XML data format: <span class="blastxml">blastxml</span>' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 13
0
 def test_0010_upload_file( self ):
     """Test uploading 4.bed.gz, manually setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '4.bed.gz', dbkey='hg17', ftype='bed' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '4.bed', hid=str( hda.hid ) )
     self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 14
0
 def test_0040_upload_file( self ):
     """Test uploading 1.sff, NOT setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '1.sff' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '1.sff', hid=str( hda.hid ) )
     self.check_history_for_string( 'format: <span class="sff">sff' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 15
0
 def test_0025_upload_file( self ):
     """Test uploading 1.scf.zip, manually setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '1.scf.zip', ftype='binseq.zip' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '1.scf.zip', hid=str( hda.hid ) )
     self.check_history_for_string( "Archive of 1 binary sequence files</pre>" )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 16
0
 def test_0115_upload_file( self ):
     """Test uploading html_file.txt, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( 'html_file.txt' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string( 'The uploaded file contains inappropriate content' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 17
0
def get_library( name, description, synopsis ):
    return sa_session.query( galaxy.model.Library ) \
                     .filter( and_( galaxy.model.Library.table.c.name==name,
                                    galaxy.model.Library.table.c.description==description,
                                    galaxy.model.Library.table.c.synopsis==synopsis,
                                    galaxy.model.Library.table.c.deleted==False ) ) \
                     .first()
Ejemplo n.º 18
0
def get_installed_repository_by_name_owner_changeset_revision(
        name, owner, changeset_revision):
    return sa_session.query( model.ToolShedRepository ) \
                     .filter( and_( model.ToolShedRepository.table.c.name == name,
                                    model.ToolShedRepository.table.c.owner == owner,
                                    model.ToolShedRepository.table.c.installed_changeset_revision == changeset_revision ) ) \
                     .one()
Ejemplo n.º 19
0
 def test_0015_upload_file(self):
     """Test uploading 1.scf, manually setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('1.scf', ftype='scf')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('1.scf', hid=str(hda.hid))
     self.check_history_for_string("Binary scf sequence file</pre>")
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 20
0
def delete_request_type_permissions( id ):
    rtps = sa_session.query( galaxy.model.RequestTypePermissions ) \
                     .filter( and_( galaxy.model.RequestTypePermissions.table.c.request_type_id==id ) ) \
                     .order_by( desc( galaxy.model.RequestTypePermissions.table.c.create_time ) )
    for rtp in rtps:
        sa_session.delete( rtp )
    sa_session.flush()
Ejemplo n.º 21
0
 def test_020_create_user_as_admin( self ):
     ''' Testing creating users as an admin '''
     self.logout()
     self.login( '*****@*****.**' )
     form_one = get_latest_form(form_one_name)
     user_info_values=['Educational', 'Penn State', True]
     self.create_user_with_info( '*****@*****.**', 'testuser', 'test13', 
                                 user_info_forms='single',
                                 user_info_form_id=form_one.id, 
                                 user_info_values=user_info_values )
     self.logout()
     self.login( '*****@*****.**' )
     user = sa_session.query( galaxy.model.User ) \
                      .filter( and_( galaxy.model.User.table.c.email=='*****@*****.**' ) ).first()
     self.home()
     page = "admin/users?id=%s&operation=information&f-deleted=False" % self.security.encode_id( user.id )
     self.visit_page( page )
     self.check_page_for_string( 'Manage User Information' )
     self.check_page_for_string( '*****@*****.**' )
     self.check_page_for_string( user_info_values[0] )
     self.check_page_for_string( user_info_values[1] )
     self.check_page_for_string( '<input type="checkbox" name="field_2" value="true" checked>' )
     # lets delete the 'Student' user info form
     self.login( '*****@*****.**' )
     form_one_latest = get_latest_form(form_one_name)
     form_one_latest.current.deleted = True
     sa_session.add( form_one_latest.current )
     sa_session.flush()
     self.home()
     self.visit_page('forms/manage?sort=create_time&f-deleted=True')
     self.check_page_for_string(form_one_latest.name)
     self.logout()
Ejemplo n.º 22
0
def get_user_address( user, short_desc ):
    return sa_session.query( galaxy.model.UserAddress ) \
                     .filter( and_( galaxy.model.UserAddress.table.c.user_id==user.id,
                                    galaxy.model.UserAddress.table.c.desc==short_desc,
                                    galaxy.model.UserAddress.table.c.deleted==False ) ) \
                     .order_by( desc( galaxy.model.UserAddress.table.c.create_time ) ) \
                     .first()   
Ejemplo n.º 23
0
 def test_030_clone_shared_history(self):
     """Testing cloning a shared history"""
     # logged in as admin user
     self.logout()
     self.login(email=regular_user1.email)
     # Shared history3 affects history options
     self.history_options(user=True, histories_shared_by_others=True)
     # Shared history3 should be in regular_user1's list of shared histories
     self.view_shared_histories(check_str=history3.name, check_str2=admin_user.email)
     self.clone_history(
         self.security.encode_id(history3.id),
         "activatable",
         check_str_after_submit="is now included in your previously stored histories.",
     )
     global history3_clone1
     history3_clone1 = (
         sa_session.query(galaxy.model.History)
         .filter(
             and_(
                 galaxy.model.History.table.c.deleted == False,
                 galaxy.model.History.table.c.user_id == regular_user1.id,
             )
         )
         .order_by(desc(galaxy.model.History.table.c.create_time))
         .first()
     )
     assert history3_clone1 is not None, "Problem retrieving history3_clone1 from database"
     # Check list of histories to make sure shared history3 was cloned
     check_str = "Clone of '%s' shared by '%s'" % (history3.name, admin_user.email)
     self.view_stored_active_histories(check_str=check_str)
Ejemplo n.º 24
0
 def test_0020_upload_file(self):
     """Test uploading 1.scf, NOT setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('1.scf')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string(
         "File Format' to 'Scf' when uploading scf files")
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 25
0
 def test_045_change_permissions_on_current_history(self):
     """Testing changing permissions on the current history"""
     # Logged in as regular_user3
     self.logout()
     self.login(email=admin_user.email)
     # Current history is history4
     self.new_history()
     global history5
     history5 = (
         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()
     )
     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"))
     # Current history is hostory5
     sa_session.refresh(history5)
     # Due to the limitations of twill ( not functional with the permissions forms ), we're forced
     # to do this manually.  At this point, we just want to restrict the access permission on history5
     # to the admin_user
     global access_action
     access_action = galaxy.model.Dataset.permitted_actions.DATASET_ACCESS.action
     dhp = galaxy.model.DefaultHistoryPermissions(history5, access_action, admin_user_private_role)
     sa_session.add(dhp)
     sa_session.flush()
     sa_session.refresh(history5)
     global history5_default_permissions
     history5_default_permissions = [dhp.action for dhp in history5.default_permissions]
     # Sort for later comparison
     history5_default_permissions.sort()
     self.upload_file("1.bed", dbkey="hg18")
     history5_dataset1 = None
     for hda in history5.datasets:
         if hda.name == "1.bed":
             history5_dataset1 = hda.dataset
             break
     assert history5_dataset1 is not None, "Problem retrieving history5_dataset1 from the database"
     # The permissions on the dataset should be restricted from sharing with anyone due to the
     # inherited history permissions
     dataset_permissions = [a.action for a in history5_dataset1.actions]
     dataset_permissions.sort()
     if dataset_permissions != history5_default_permissions:
         err_msg = (
             "Dataset permissions for history5_dataset1 (%s) were not correctly inherited from history permissions (%s)"
             % (str(dataset_permissions), str(history5_default_permissions))
         )
         raise AssertionError, err_msg
     # Make sure when we logout and login, the history default permissions are preserved
     self.logout()
     self.login(email=admin_user.email)
     sa_session.refresh(history5)
     current_history_permissions = [dhp.action for dhp in history5.default_permissions]
     current_history_permissions.sort()
     if current_history_permissions != history5_default_permissions:
         raise AssertionError, "With logout and login, the history default permissions are not preserved"
Ejemplo n.º 26
0
def get_user_address(user, short_desc):
    return sa_session.query( galaxy.model.UserAddress ) \
                     .filter( and_( galaxy.model.UserAddress.table.c.user_id==user.id,
                                    galaxy.model.UserAddress.table.c.desc==short_desc,
                                    galaxy.model.UserAddress.table.c.deleted==False ) ) \
                     .order_by( desc( galaxy.model.UserAddress.table.c.create_time ) ) \
                     .first()
Ejemplo n.º 27
0
def get_galaxy_repository_by_name_owner_changeset_revision(
        repository_name, owner, changeset_revision):
    return ga_session.query( galaxy.model.ToolShedRepository ) \
                     .filter( and_( galaxy.model.ToolShedRepository.table.c.name == repository_name,
                                    galaxy.model.ToolShedRepository.table.c.owner == owner,
                                    galaxy.model.ToolShedRepository.table.c.changeset_revision == changeset_revision ) ) \
                     .first()
Ejemplo n.º 28
0
def get_library(name, description, synopsis):
    return sa_session.query( galaxy.model.Library ) \
                     .filter( and_( galaxy.model.Library.table.c.name==name,
                                    galaxy.model.Library.table.c.description==description,
                                    galaxy.model.Library.table.c.synopsis==synopsis,
                                    galaxy.model.Library.table.c.deleted==False ) ) \
                     .first()
Ejemplo n.º 29
0
def delete_request_type_permissions(id):
    rtps = sa_session.query( galaxy.model.RequestTypePermissions ) \
                     .filter( and_( galaxy.model.RequestTypePermissions.table.c.request_type_id==id ) ) \
                     .order_by( desc( galaxy.model.RequestTypePermissions.table.c.create_time ) )
    for rtp in rtps:
        sa_session.delete(rtp)
    sa_session.flush()
Ejemplo n.º 30
0
 def test_040_sharing_mulitple_histories_with_multiple_users(self):
     """Testing sharing multiple histories containing only public datasets with multiple users"""
     # Logged in as admin_user
     self.new_history()
     global history4
     history4 = (
         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()
     )
     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"))
     sa_session.refresh(history4)
     self.upload_file("2.bed", dbkey="hg18")
     ids = "%s,%s" % (self.security.encode_id(history3.id), self.security.encode_id(history4.id))
     emails = "%s,%s" % (regular_user2.email, regular_user3.email)
     self.share_histories_with_users(ids, emails, check_str1="Share 2 histories", check_str2=history4.name)
     self.logout()
     self.login(email=regular_user2.email)
     # Shared history3 should be in regular_user2's list of shared histories
     self.view_shared_histories(check_str=history3.name, check_str2=admin_user.email)
     self.logout()
     self.login(email=regular_user3.email)
     # Shared history3 should be in regular_user3's list of shared histories
     self.view_shared_histories(check_str=history3.name, check_str2=admin_user.email)
Ejemplo n.º 31
0
 def test_0065_upload_file(self):
     """Test uploading asian_chars_1.txt, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('asian_chars_1.txt')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('asian_chars_1.txt', hid=str(hda.hid))
     self.check_history_for_string('uploaded multi-byte char file')
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 32
0
 def test_0065_upload_file( self ):
     """Test uploading asian_chars_1.txt, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( 'asian_chars_1.txt' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( 'asian_chars_1.txt', hid=str( hda.hid ) )
     self.check_history_for_string( 'uploaded multi-byte char file' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 33
0
 def test_0035_upload_file(self):
     """Test uploading 1.sam NOT setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('1.sam')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('1.sam', hid=str(hda.hid))
     self.check_history_for_string(
         "<th>1.QNAME</th><th>2.FLAG</th><th>3.RNAME</th><th>4.POS</th>")
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 34
0
 def test_0115_upload_file(self):
     """Test uploading html_file.txt, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('html_file.txt')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string(
         'The uploaded file contains inappropriate content')
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 35
0
 def test_0010_upload_file(self):
     """Test uploading 4.bed.gz, manually setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('4.bed.gz', dbkey='hg17', ftype='bed')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('4.bed', hid=str(hda.hid))
     self.check_history_for_string(
         "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>")
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 36
0
 def test_00_metadata_edit( self ):
     """test_metadata_edit: Testing metadata editing"""
     self.logout()
     self.login( email='*****@*****.**' )
     admin_user = sa_session.query( galaxy.model.User ) \
                           .filter( galaxy.model.User.table.c.email=='*****@*****.**' ) \
                           .one()
     self.new_history( name='Test Metadata Edit' )
     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()
     self.upload_file( '1.bed' )
     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.
     for dp in latest_hda.dataset.actions:
         sa_session.delete( dp )
         sa_session.flush()
     sa_session.refresh( latest_hda.dataset )
     self.check_history_for_string( '1.bed' )
     self.check_metadata_for_string( '1.bed uploaded file unspecified (\?) chromCol value="1" selected endCol value="3" is_strandCol value="true" checked', hid=str( latest_hda.hid ) )
     """test editing attributes"""
     self.edit_hda_attribute_info( hda_id=str( latest_hda.id ),
                                   new_name='Testdata',
                                   new_info="Uploaded my file",
                                   new_dbkey='hg16',
                                   new_startcol='6' )
     self.check_metadata_for_string( 'Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="6" selected', hid=str( latest_hda.hid ) )
     """test Auto-detecting attributes"""
     self.auto_detect_metadata( hda_id=str( latest_hda.id ) )
     self.check_metadata_for_string('Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="2" selected', hid=str( latest_hda.hid ) )
     """test converting formats"""
     self.convert_format( hda_id=str( latest_hda.id ), target_type='gff' )
     self.check_metadata_for_string( '"gff" selected="yes"', hid=str( latest_hda.hid ) )
     """test changing data type"""
     self.change_datatype( hda_id=str( latest_hda.id ), datatype='gff3' )
     self.check_metadata_for_string( 'gff3', hid=str( latest_hda.hid ) )
     self.delete_history( id=self.security.encode_id( history1.id ) )
     self.logout()
Ejemplo n.º 37
0
 def test_0150_upload_file(self):
     """Test uploading 1.bam, which is a sorted Bam file creaed by the Galaxy sam_to_bam tool, NOT setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('1.bam')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('1.bam', hid=str(hda.hid))
     self.check_history_for_string('<span class="bam">bam</span>')
     # Make sure the Bam index was created
     assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 1.bam"
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 38
0
 def test_015_edit_user_info( self ):
     """Testing editing user info as a regular user"""
     self.logout()
     self.login( '*****@*****.**' )
     user = sa_session.query( galaxy.model.User ) \
                      .filter( and_( galaxy.model.User.table.c.email=='*****@*****.**' ) ).first()
     self.edit_login_info( new_email='*****@*****.**', new_username='******' )
     self.change_password('testuser', 'new_testuser')
     self.edit_user_info( ['Research', 'PSU'] )
Ejemplo n.º 39
0
 def test_0090_upload_file( self ):
     """Test uploading qualscores.qual454, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( 'qualscores.qual454' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( 'qualscores.qual454', hid=str( hda.hid ) )
     self.check_history_for_string( '49 lines, format: <span class="qual454">qual454</span>, database: \?' )
     self.check_metadata_for_string( 'Change data type value="qual454" selected="yes">qual454' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 40
0
 def test_0135_upload_file( self ):
     """Test uploading shrimp_cs_test1.csfasta, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( 'shrimp_cs_test1.csfasta' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( 'shrimp_cs_test1.csfasta', hid=str( hda.hid ) )
     self.check_history_for_string( '2,500 sequences, format: <span class="csfasta">csfasta</span>, <td>&gt;2_14_26_F3,-1282216.0</td>' )
     self.check_metadata_for_string( 'value="shrimp_cs_test1.csfasta" value="\?" Change data type value="csfasta" selected="yes"' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 41
0
 def test_0145_upload_file( self ):
     """Test uploading 1.axt, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '1.axt' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '1.axt', hid=str( hda.hid ) )
     self.check_history_for_string( '1.axt format: <span class="axt">axt</span>, database: \? Info: uploaded file' )
     self.check_metadata_for_string( 'value="1.axt" value="\?" Change data type selected value="axt" selected="yes"' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 42
0
 def test_0140_upload_file(self):
     """Test uploading megablast_xml_parser_test1.gz, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('megablast_xml_parser_test1.gz')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.check_history_for_string(
         'NCBI Blast XML data format: <span class="blastxml">blastxml</span>'
     )
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 43
0
 def test_0150_upload_file( self ):
     """Test uploading 1.bam, which is a sorted Bam file creaed by the Galaxy sam_to_bam tool, NOT setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '1.bam' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '1.bam', hid=str( hda.hid ) )
     self.check_history_for_string( '<span class="bam">bam</span>' )
     # Make sure the Bam index was created
     assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 1.bam"
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 44
0
def get_form( name ):
    fdc_list = sa_session.query( galaxy.model.FormDefinitionCurrent ) \
                         .filter( galaxy.model.FormDefinitionCurrent.table.c.deleted == False ) \
                         .order_by( galaxy.model.FormDefinitionCurrent.table.c.create_time.desc() )
    for fdc in fdc_list:
        sa_session.refresh( fdc )
        sa_session.refresh( fdc.latest_form )
        if fdc.latest_form.name == name:
            return fdc.latest_form
    return None
Ejemplo n.º 45
0
 def test_015_edit_user_info(self):
     """Testing editing user info as a regular user"""
     self.logout()
     self.login('*****@*****.**')
     user = sa_session.query( galaxy.model.User ) \
                      .filter( and_( galaxy.model.User.table.c.email=='*****@*****.**' ) ).first()
     self.edit_login_info(new_email='*****@*****.**',
                          new_username='******')
     self.change_password('testuser', 'new_testuser')
     self.edit_user_info(['Research', 'PSU'])
Ejemplo n.º 46
0
 def test_0070_upload_file(self):
     """Test uploading 2gen.fastq, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('2gen.fastq')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('2gen.fastq', hid=str(hda.hid))
     self.check_history_for_string(
         '2gen.fastq format: <span class="fastq">fastq</span>, database: \? Info: uploaded fastq file'
     )
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 47
0
def get_latest_form(form_name):
    fdc_list = sa_session.query( galaxy.model.FormDefinitionCurrent ) \
                         .filter( galaxy.model.FormDefinitionCurrent.table.c.deleted==False ) \
                         .order_by( galaxy.model.FormDefinitionCurrent.table.c.create_time.desc() )
    for fdc in fdc_list:
        sa_session.refresh(fdc)
        sa_session.refresh(fdc.latest_form)
        if form_name == fdc.latest_form.name:
            return fdc.latest_form
    return None
Ejemplo n.º 48
0
 def test_0155_upload_file( self ):
     """Test uploading 3.bam, which is an unsorted Bam file, NOT setting the file format"""
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '3.bam' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     # Since 3.bam is not sorted, we cannot verify dataset correctness since the uploaded
     # dataset will be sorted.  However, the check below to see if the index was created is
     # sufficient.
     self.check_history_for_string( '<span class="bam">bam</span>' )
     # Make sure the Bam index was created
     assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 3.bam"
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 49
0
 def test_0095_upload_file( self ):
     """Test uploading 3.maf, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string( 'Your history is empty' )
     history = 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()
     self.upload_file( '3.maf' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '3.maf', hid=str( hda.hid ) )
     self.check_history_for_string( '3.maf format: <span class="maf">maf</span>, database: \? Info: uploaded file' )
     self.check_metadata_for_string( 'value="3.maf" value="\?"' )
     self.check_metadata_for_string( 'Convert to new format <option value="interval">Convert MAF to Genomic Intervals <option value="fasta">Convert MAF to Fasta' )
     self.check_metadata_for_string( 'Change data type selected value="maf" selected="yes"' )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 50
0
 def test_0155_upload_file(self):
     """Test uploading 3.bam, which is an unsorted Bam file, NOT setting the file format"""
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('3.bam')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     # Since 3.bam is not sorted, we cannot verify dataset correctness since the uploaded
     # dataset will be sorted.  However, the check below to see if the index was created is
     # sufficient.
     self.check_history_for_string('<span class="bam">bam</span>')
     # Make sure the Bam index was created
     assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 3.bam"
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 51
0
 def test_0005_upload_file( self ):
     """Test uploading 1.bed, NOT setting the file format"""
     self.logout()
     self.login( email='*****@*****.**' )
     global admin_user
     admin_user = sa_session.query( galaxy.model.User ) \
                            .filter( galaxy.model.User.table.c.email=='*****@*****.**' ) \
                            .one()
     history = 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()
     self.upload_file( '1.bed' )
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness( '1.bed', hid=str( hda.hid ) )
     self.check_history_for_string( "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>" )
     self.delete_history( id=self.security.encode_id( history.id ) )
Ejemplo n.º 52
0
 def test_020_create_request_type( self ):
     """Testing creating a new requestype"""
     request_form = get_latest_form(form_one_name)
     sample_form = get_latest_form(form_two_name)
     self.create_request_type(request_type_name, "test request type", 
                              str(request_form.id), str(sample_form.id), sample_states )
     global request_type
     request_type = sa_session.query( galaxy.model.RequestType ) \
                              .filter( and_( galaxy.model.RequestType.table.c.name==request_type_name ) ) \
                              .order_by( desc( galaxy.model.RequestType.table.c.create_time ) ) \
                              .first()
     assert request_type is not None, 'Problem retrieving request type named "%s" from the database' % request_type_name
Ejemplo n.º 53
0
 def test_0090_upload_file(self):
     """Test uploading qualscores.qual454, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('qualscores.qual454')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('qualscores.qual454', hid=str(hda.hid))
     self.check_history_for_string(
         '49 lines, format: <span class="qual454">qual454</span>, database: \?'
     )
     self.check_metadata_for_string(
         'Change data type value="qual454" selected="yes">qual454')
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 54
0
 def test_020_create_request_type(self):
     """Testing creating a new requestype"""
     request_form = get_latest_form(form_one_name)
     sample_form = get_latest_form(form_two_name)
     self.create_request_type(request_type_name, "test request type",
                              str(request_form.id), str(sample_form.id),
                              sample_states)
     global request_type
     request_type = sa_session.query( galaxy.model.RequestType ) \
                              .filter( and_( galaxy.model.RequestType.table.c.name==request_type_name ) ) \
                              .order_by( desc( galaxy.model.RequestType.table.c.create_time ) ) \
                              .first()
     assert request_type is not None, 'Problem retrieving request type named "%s" from the database' % request_type_name
Ejemplo n.º 55
0
 def test_0005_upload_file(self):
     """Test uploading 1.bed, NOT setting the file format"""
     self.logout()
     self.login(email='*****@*****.**')
     global admin_user
     admin_user = sa_session.query( galaxy.model.User ) \
                            .filter( galaxy.model.User.table.c.email=='*****@*****.**' ) \
                            .one()
     history = 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()
     self.upload_file('1.bed')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('1.bed', hid=str(hda.hid))
     self.check_history_for_string(
         "<th>1.Chrom</th><th>2.Start</th><th>3.End</th>")
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 56
0
 def test_0145_upload_file(self):
     """Test uploading 1.axt, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('1.axt')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('1.axt', hid=str(hda.hid))
     self.check_history_for_string(
         '1.axt format: <span class="axt">axt</span>, database: \? Info: uploaded file'
     )
     self.check_metadata_for_string(
         'value="1.axt" value="\?" Change data type selected value="axt" selected="yes"'
     )
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 57
0
 def test_0135_upload_file(self):
     """Test uploading shrimp_cs_test1.csfasta, NOT setting the file format"""
     # Logged in as admin_user
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_file('shrimp_cs_test1.csfasta')
     hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
                     .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
                     .first()
     assert hda is not None, "Problem retrieving hda from database"
     self.verify_dataset_correctness('shrimp_cs_test1.csfasta',
                                     hid=str(hda.hid))
     self.check_history_for_string(
         '2,500 sequences, format: <span class="csfasta">csfasta</span>, <td>&gt;2_14_26_F3,-1282216.0</td>'
     )
     self.check_metadata_for_string(
         'value="shrimp_cs_test1.csfasta" value="\?" Change data type value="csfasta" selected="yes"'
     )
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 58
0
 def test_0160_url_paste(self):
     """Test url paste behavior"""
     # Logged in as admin_user
     # Deleting the current history should have created a new history
     self.check_history_for_string('Your history is empty')
     history = 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()
     self.upload_url_paste('hello world')
     self.check_history_for_string('Pasted Entry')
     self.check_history_for_string('hello world')
     self.upload_url_paste(u'hello world')
     self.check_history_for_string('Pasted Entry')
     self.check_history_for_string('hello world')
     self.delete_history(id=self.security.encode_id(history.id))
Ejemplo n.º 59
0
 def test_030_create_request(self):
     """Testing creating, editing and submitting a request as a regular user"""
     # login as a regular user
     self.logout()
     self.login(email='*****@*****.**')
     # set field values
     fields = ['option1', str(user_address.id), 'field three value']
     # create the request
     request_name, request_desc = 'Request One', 'Request One Description'
     self.create_request(request_type.id, request_name, request_desc,
                         library_one.id, 'none', fields)
     global request_one
     request_one = sa_session.query( galaxy.model.Request ) \
                             .filter( and_( galaxy.model.Request.table.c.name==request_name,
                                            galaxy.model.Request.table.c.deleted==False ) ) \
                             .first()
     # check if the request's state is now set to 'new'
     assert request_one.state is not request_one.states.NEW, "The state of the request '%s' should be set to '%s'" \
         % ( request_one.name, request_one.states.NEW )
     # sample fields
     samples = [('Sample One', ['S1 Field 0 Value']),
                ('Sample Two', ['S2 Field 0 Value'])]
     # add samples to this request
     self.add_samples(request_one.id, request_one.name, samples)
     # edit this request
     fields = [
         'option2',
         str(user_address.id), 'field three value (edited)'
     ]
     self.edit_request(request_one.id, request_one.name,
                       request_one.name + ' (Renamed)',
                       request_one.desc + ' (Re-described)', library_one.id,
                       folder_one.id, fields)
     sa_session.refresh(request_one)
     # check if the request is showing in the 'new' filter
     self.check_request_grid(state='New', request_name=request_one.name)
     # submit the request
     self.submit_request(request_one.id, request_one.name)
     sa_session.refresh(request_one)
     # check if the request is showing in the 'submitted' filter
     self.check_request_grid(state='Submitted',
                             request_name=request_one.name)
     # check if the request's state is now set to 'submitted'
     assert request_one.state is not request_one.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \
         % ( request_one.name, request_one.states.SUBMITTED )