root/galaxy-central/test/functional/test_metadata_editing.py

リビジョン 2, 3.1 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1import galaxy.model
2from galaxy.model.orm import *
3from galaxy.model.mapping import context as sa_session
4from base.twilltestcase import TwillTestCase
5
6class TestMetadataEdit( TwillTestCase ):
7
8    def test_00_metadata_edit( self ):
9        """test_metadata_edit: Testing metadata editing"""
10        self.logout()
11        self.login( email='test@bx.psu.edu', username='admin-user' )
12        admin_user = sa_session.query( galaxy.model.User ) \
13                              .filter( galaxy.model.User.table.c.email=='test@bx.psu.edu' ) \
14                              .one()
15        self.new_history( name='Test Metadata Edit' )
16        history1 = sa_session.query( galaxy.model.History ) \
17                            .filter( and_( galaxy.model.History.table.c.deleted==False,
18                                           galaxy.model.History.table.c.user_id==admin_user.id ) ) \
19                            .order_by( desc( galaxy.model.History.table.c.create_time ) ) \
20                            .first()
21        self.upload_file( '1.bed' )
22        latest_hda = sa_session.query( galaxy.model.HistoryDatasetAssociation ) \
23                              .order_by( desc( galaxy.model.HistoryDatasetAssociation.table.c.create_time ) ) \
24                              .first()
25        self.home()
26        # Due to twill not being able to handle the permissions forms, we'll eliminate
27        # DefaultHistoryPermissions prior to uploading a dataset so that the permission
28        # form will not be displayed on ted edit attributes page.
29        for dp in latest_hda.dataset.actions:
30            sa_session.delete( dp )
31            sa_session.flush()
32        sa_session.refresh( latest_hda.dataset )
33        self.check_history_for_string( '1.bed' )
34        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 ) )
35        """test editing attributes"""
36        self.edit_hda_attribute_info( hda_id=str( latest_hda.id ),
37                                      new_name='Testdata',
38                                      new_info="Uploaded my file",
39                                      new_dbkey='hg16',
40                                      new_startcol='6' )
41        self.check_metadata_for_string( 'Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="6" selected', hid=str( latest_hda.hid ) )
42        """test Auto-detecting attributes"""
43        self.auto_detect_metadata( hda_id=str( latest_hda.id ) )
44        self.check_metadata_for_string('Testdata bed Uploaded my file hg16 "bed" selected="yes" "startCol" value="2" selected', hid=str( latest_hda.hid ) )
45        """test converting formats"""
46        self.convert_format( hda_id=str( latest_hda.id ), target_type='gff' )
47        self.check_metadata_for_string( '"gff" selected="yes"', hid=str( latest_hda.hid ) )
48        """test changing data type"""
49        self.change_datatype( hda_id=str( latest_hda.id ), datatype='gff3' )
50        self.check_metadata_for_string( 'gff3', hid=str( latest_hda.hid ) )
51        self.delete_history( id=self.security.encode_id( history1.id ) )
52        self.logout()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。