Skip to content
Snippets Groups Projects
Commit 3ecffb8a authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

fix tests

parent d4b0cbd4
No related branches found
No related tags found
3 merge requests!1571catch 2.8.2.3 up with main,!15592.8.2.2-DEVELOPMENT into main,!1551Cherry pick partial curation for patch
{
"parameters": {
"reingest": false,
"ngas_ingest": true,
"telescope": "EVLA",
"ingestion_path": "/lustre/aoc/cluster/pipeline/dsoc-prod/stage_products/20A-346_2021_07_23_T13_37_08.376"
......
{
"parameters": {
"reingest": false,
"ngas_ingest": true,
"telescope": "EVLA",
"ingestion_path": "/lustre/aoc/cluster/pipeline/dsoc-prod/stage_products/20A-346_2021_07_23_T13_37_08.376"
......
......@@ -43,6 +43,7 @@ from ingest_envoy.manifest_components import (
ManifestParameters,
OutputGroup,
OutputScienceProduct,
ParamsKey,
)
from ingest_envoy.utilities import AncillaryProductType, ScienceProductType, Telescope
......@@ -88,7 +89,7 @@ def test_filters_cal_input_files(ingest_path: Path):
assert manifest.locator == locator
params = manifest.parameters
assert params.reingest is False
assert params.ngas_ingest is True
assert not hasattr(params, "calibrate")
input_group = manifest.input_group
......@@ -162,7 +163,6 @@ def test_params_json_well_formed():
"""
params = ManifestParameters(
telescope=Telescope.EVLA,
reingest=False,
ngas_ingest=False,
calibrate=False,
staging_source_dir=Path("/home/mchammer/evla/parallel-prod"),
......@@ -331,13 +331,13 @@ def test_evla_cal_manifest_matches_example(ingest_path: Path):
with open(manifest_file, "r") as infile:
actual_json = dict(json.load(infile).items())
actual_json[IngestionManifestKey.PARAMETERS.value][IngestionManifestKey.INGESTION_PATH.value] = expected_dir_name
actual_json[IngestionManifestKey.PARAMETERS.value][ParamsKey.INGESTION_PATH.value] = expected_dir_name
expected_params = expected_json["parameters"]
actual_params = manifest.parameters.to_dict()
expected_reingest = expected_params["reingest"]
assert actual_params["reingest"] == expected_reingest
expected_ngas_ingest = expected_params["ngas_ingest"]
assert actual_params["ngas_ingest"] == expected_ngas_ingest
assert "calibrate" not in actual_params.keys()
assert manifest.input_group.to_dict() == expected_json["input_group"]
......@@ -438,8 +438,8 @@ def test_evla_cal_final_manifest_matches_example(ingest_path: Path):
expected_params = expected_json["parameters"]
actual_params = manifest.parameters.to_dict()
expected_reingest = expected_params["reingest"]
assert actual_params["reingest"] == expected_reingest
expected_ngas_ingest = expected_params["ngas_ingest"]
assert actual_params["ngas_ingest"] == expected_ngas_ingest
assert "calibrate" not in actual_params.keys()
assert manifest.input_group.to_dict() == expected_json["input_group"]
......
......@@ -67,7 +67,7 @@ class TestIngestCalibrationLauncher:
def test_launch_ingestion(self):
with patch("ingest_envoy.launchers.IngestCalibrationLauncher.prepare_for_ingest") as prepare:
with patch("ingest_envoy.launchers.trigger_ingest") as ingest:
IngestCalibrationLauncher(parameters).launch_ingestion()
IngestCalibrationLauncher(IngestType.CAL, parameters).launch()
assert prepare.call_count == 1
assert ingest.call_count == 1
......@@ -75,20 +75,20 @@ class TestIngestCalibrationLauncher:
def test_prepare_for_ingest(self, mock_run):
with patch("ingest_envoy.launchers.IngestCalibrationLauncher.run_collection_script") as collector:
with patch("ingest_envoy.launchers.IngestCalibrationLauncher.create_manifest") as manifest:
IngestCalibrationLauncher(parameters).prepare_for_ingest()
IngestCalibrationLauncher(IngestType.CAL, parameters).prepare_for_launch()
assert collector.call_count == 1
assert manifest.call_count == 1
@patch("subprocess.run")
def test_run_collection_script(self, mock_run):
mock_run.return_value.returncode = 0
IngestCalibrationLauncher(parameters).run_collection_script()
IngestCalibrationLauncher(IngestType.CAL, parameters).run_collection_script()
assert mock_run.call_count == 1
@pytest.mark.skip("Skip. Ignores manifest builder mock")
def test_create_manifest(self):
with patch("ingest_envoy.ingestion_manifest.IngestionManifestBuilder.build") as manifest:
IngestCalibrationLauncher(parameters).create_manifest()
IngestCalibrationLauncher(IngestType.CAL, parameters).create_manifest()
assert manifest.call_count == 1
......@@ -96,14 +96,14 @@ class TestIngestImageLauncher:
def test_launch_ingestion(self):
with patch("ingest_envoy.launchers.IngestImageLauncher.prepare_for_ingest") as prepare:
with patch("ingest_envoy.launchers.trigger_ingest") as ingest:
IngestImageLauncher(IngestType.IMG, image_parameters).launch_ingestion()
IngestImageLauncher(IngestType.IMG, image_parameters).launch()
assert prepare.call_count == 1
assert ingest.call_count == 1
def test_prepare_for_ingest(self):
with patch("ingest_envoy.launchers.IngestImageLauncher.run_collector") as collector:
with patch("ingest_envoy.launchers.IngestImageLauncher.create_manifest") as manifest:
IngestImageLauncher(IngestType.IMG, image_parameters).prepare_for_ingest()
IngestImageLauncher(IngestType.IMG, image_parameters).prepare_for_launch()
assert collector.call_count == 1
assert manifest.call_count == 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment