test_level0.py 3.08 KB
Newer Older
Wei Shoulin's avatar
Wei Shoulin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import unittest
import time
from csst_dfs_client import level0

class Level0TestCase(unittest.TestCase):

    def setUp(self):
        pass

    def test_find(self):
        start_time = time.time()
        result = level0.find(obs_id = "10609400034529",
                            create_time = ("2021-08-30 00:00:00", "2024-12-30 23:59:59"))
        start_time = time.time()
        result = level0.find(ra_obj = 170,
                            dec_obj = -24,
                            radius = 2)
        print(f"操作执行时间: {time.time() - start_time} 秒")
        result = level0.find(file_name="CSST_MSC_MS_SCI_20240609181116_20240609181347_101091001")
        print(f"操作执行时间: {time.time() - start_time} 秒, 数据量:{result['total_count']}")        
        self.assertEqual(result.code, 200, "error code: " + str(result.code))
        self.assertIsNotNone(result.data, "error message: " + result.message)

    # def test_find_by_level0_id(self):
    #     result = level0.find_by_level0_id(level0_id = "1060940003452925")
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)
    #     self.assertIsNotNone(result.data, "error message: " + result.message)

    # def test_update_qc0_status(self):
    #     result = level0.update_qc0_status(level0_id = "1060940003452925", file_type='SCI', qc0_status=1)
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)

    # def test_update_prc_status(self):
    #     result = level0.update_prc_status(level0_id = "1060940003452925", file_type='SCI', prc_status=3)
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)

Wei Shoulin's avatar
plan    
Wei Shoulin committed
40
41
42
43
44
    # def test_write(self):
    #     file_path = "/Users/wsl/temp/csst/import/CSST_MSC_MS_SCI_20240609181116_20240609181347_10109100157991_27_L0_V01.fits"
    #     result = level0.write(local_file = file_path)
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)
Wei Shoulin's avatar
Wei Shoulin committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

    # def test_generate_prc_message(self):
    #     result = level0.generate_prc_msg(
    #         module_id='MSC',
    #         obs_id="10609400034529",
    #         detector_no="30")
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)

    # def test_process_list(self):
    #     result = level0.process_list(level0_id="1060940003452925")
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)
    # def test_add_process(self):
    #     result = level0.add_process(level0_id="1060940003452925", pipeline_id="csst-msc-l1-mbi", run_id="202411071002481234", prc_time="2024-11-07 10:24:12", prc_status=1, prc_module="MSC", message="")
    #     print(result)
    #     self.assertEqual(result.code, 200, "error code: " + str(result.code) + ", message: " + result.message)