test_ifs_fits.py 717 Bytes
Newer Older
Xie Zhou's avatar
update    
Xie Zhou committed
1
import logging
Wei Shoulin's avatar
Wei Shoulin committed
2
3
4
5
import unittest

from csst_dfs_api_local.ifs import FitsApi

Xie Zhou's avatar
update    
Xie Zhou committed
6
log = logging.getLogger('csst')
Wei Shoulin's avatar
Wei Shoulin committed
7
8
9
10
class IFSFitsTestCase(unittest.TestCase):

    def setUp(self):
        self.api = FitsApi()
Xie Zhou's avatar
update    
Xie Zhou committed
11
        self.api.scan2db()
Wei Shoulin's avatar
Wei Shoulin committed
12
13

    def test_find(self):
Xie Zhou's avatar
update    
Xie Zhou committed
14
15
16
17
18
19
20
21
22
23
24
        path = self.api.find(obs_time=900, type='obs')
        log.info('find', path)
        path = self.api.find(fits_id='CCD2_ObsTime_600_ObsNum_8')
        log.info('find', path)
    
    def test_read(self):
        file = self.api.read(fits_id='CCD2_ObsTime_600_ObsNum_8')
        log.info('read', str(type(file)))
        path = self.api.find(obs_time=900, type='obs')
        file = self.api.read(file_path=path)
        log.info('read', str(type(file)))