Skip to content

Commit

Permalink
small test
Browse files Browse the repository at this point in the history
  • Loading branch information
burnout87 committed Jul 28, 2023
1 parent baab853 commit 81dea2a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from cdci_data_analysis.pytest_fixtures import DispatcherJobState
from conftest import remove_old_token_files, remove_scratch_folders
from collections import OrderedDict

secret_key = 'secretkey_test'
default_exp_time = int(time.time()) + 5000
Expand Down Expand Up @@ -103,6 +104,33 @@ def test_job_id_data_collection(dispatcher_api):
assert job_id_second_request != job_id_first_request


def test_oda_api_code_boolean():
par_dict = {

Check warning on line 108 in tests/test_basic.py

View check run for this annotation

Codecov / codecov/patch

tests/test_basic.py#L108

Added line #L108 was not covered by tests
"DEC": -29.74516667,
"RA": 265.97845833,
"T1": "2017-03-06T13:26:48.000",
"T2": "2017-03-06T15:32:27.000",
"T_format": "isot",
"api": "True",
"instrument": "empty",
"oda_api_version": "{oda_api.__version__}",
"off_line": "False",
"p_list": [],
"b": True,
"product_type": "dummy",
"src_name": "1E 1740.7-2942"
}

output_api_code = oda_api.api.DispatcherAPI.set_api_code(par_dict)

Check warning on line 124 in tests/test_basic.py

View check run for this annotation

Codecov / codecov/patch

tests/test_basic.py#L124

Added line #L124 was not covered by tests

expected_api_code = json.dumps(OrderedDict(sorted(par_dict.items())), indent=4)
expected_api_code = expected_api_code.replace("true", "True")
expected_api_code = expected_api_code.replace("false", "False")
expected_api_code = expected_api_code.replace("product_type", "product")

Check warning on line 129 in tests/test_basic.py

View check run for this annotation

Codecov / codecov/patch

tests/test_basic.py#L126-L129

Added lines #L126 - L129 were not covered by tests

assert expected_api_code in output_api_code

Check warning on line 131 in tests/test_basic.py

View check run for this annotation

Codecov / codecov/patch

tests/test_basic.py#L131

Added line #L131 was not covered by tests


def test_oda_api_code(dispatcher_api):
disp = dispatcher_api

Expand Down

0 comments on commit 81dea2a

Please sign in to comment.