test_facility_level0.py 1.24 KB
Newer Older
Wei Shoulin's avatar
c3  
Wei Shoulin committed
1
2
3
4
5
6
7
8
9
10
11
12
import os
import unittest
from astropy.io import fits

from csst_dfs_api.facility.level0 import Level0DataApi

class Level0DataTestCase(unittest.TestCase):

    def setUp(self):
        self.api = Level0DataApi()

    def test_find(self):
Wei Shoulin's avatar
Wei Shoulin committed
13
        recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
14
15
16
        print('find:', recs)

    def test_get(self):
Wei Shoulin's avatar
Wei Shoulin committed
17
        rec = self.api.get(id = 100)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
18
19
        print('get:', rec)

Wei Shoulin's avatar
Wei Shoulin committed
20
21
22
        rec = self.api.get(level0_id = '000001102')
        print('get:', rec)        

Wei Shoulin's avatar
c3  
Wei Shoulin committed
23
    def test_update_proc_status(self):
Wei Shoulin's avatar
Wei Shoulin committed
24
        rec = self.api.update_proc_status(level0_id = '000001102', status = 6)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
25
26
27
        print('update_proc_status:', rec)

    def test_update_qc0_status(self):
Wei Shoulin's avatar
Wei Shoulin committed
28
        rec = self.api.update_qc0_status(level0_id = '000001102', status = 7)
Wei Shoulin's avatar
c3  
Wei Shoulin committed
29
30
31
32
        print('update_qc0_status:', rec)

    def test_write(self):
        rec = self.api.write(
Wei Shoulin's avatar
Wei Shoulin committed
33
            level0_id = '000001101',
Wei Shoulin's avatar
Wei Shoulin committed
34
            obs_id = '0000011',
Wei Shoulin's avatar
Wei Shoulin committed
35
            detector_no = "01",
Wei Shoulin's avatar
c3  
Wei Shoulin committed
36
37
38
39
40
41
42
            obs_type = "sci",            
            obs_time = "2021-06-06 11:12:13",
            exp_time = 150,
            detector_status_id = 3,
            filename = "MSC_00001234",
            file_path = "/opt/MSC_00001234.fits")
        print('write:', rec)