Skip to content

Commit

Permalink
fix: HK and science tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Aug 7, 2024
1 parent 3eb23f1 commit 332cb24
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def test_fetch_binary_downloads_hk_from_webpoda(wiremock_manager): # noqa: F811

# Verify.
assert result.exit_code == 0
assert Path("output/power.pkts").exists()
assert Path("output/2025/05/02/imap_mag_hsk-pw_20250502_v000.pkts").exists()

with (
open("output/power.pkts", "rb") as output,
open("output/2025/05/02/imap_mag_hsk-pw_20250502_v000.pkts", "rb") as output,
open(binary_file, "rb") as input,
):
assert output.read() == input.read()
Expand All @@ -135,7 +135,7 @@ def test_fetch_science_downloads_cdf_from_sdc(wiremock_manager): # noqa: F811
)

wiremock_manager.add_string_mapping(
"/query?instrument=mag&data_level=l1b&descriptor=norm-magi&start_date=20250502&version=latest&extension=cdf",
"/query?instrument=mag&data_level=l1b&descriptor=norm-magi&start_date=20250502&end_date=20250502&extension=cdf",
json.dumps(query_response),
priority=1,
)
Expand All @@ -146,7 +146,7 @@ def test_fetch_science_downloads_cdf_from_sdc(wiremock_manager): # noqa: F811
wiremock_manager.add_string_mapping(
re.escape("/query?instrument=mag&data_level=l1b&descriptor=")
+ ".*"
+ re.escape("&start_date=20250502&version=latest&extension=cdf"),
+ re.escape("&start_date=20250502&end_date=20250502&extension=cdf"),
json.dumps({}),
is_pattern=True,
priority=2,
Expand Down Expand Up @@ -179,10 +179,12 @@ def test_fetch_science_downloads_cdf_from_sdc(wiremock_manager): # noqa: F811

# Verify.
assert result.exit_code == 0
assert Path("output/result.cdf").exists()
assert Path("output/2025/05/02/imap_mag_l1b_norm-magi_20250502_v000.cdf").exists()

with (
open("output/result.cdf", "rb") as output,
open(
"output/2025/05/02/imap_mag_l1b_norm-magi_20250502_v000.cdf", "rb"
) as output,
open(cdf_file, "rb") as input,
):
assert output.read() == input.read()
Expand Down

0 comments on commit 332cb24

Please sign in to comment.