Exemple #1
0
def test_stea(mock_stea):
    mock_stea.side_effect = calculate_patch
    main_entry_point(["-c", "stea_input.yml"])
    mock_stea.assert_called_once()
    files = os.listdir(os.getcwd())
    # the resulting file i.e. key is defined in the input config file: stea_input.yml
    assert "NPV_0" in files
Exemple #2
0
def test_stea(mock_calculate, monkeypatch):
    monkeypatch.setattr(sys, "argv", ["script_name", "-c", "stea_input.yml"])
    fm_stea.main_entry_point()
    mock_calculate.assert_called_once()
    files = os.listdir(os.getcwd())
    # the resulting file i.e. key is defined in the input config file: stea_input.yml
    assert "NPV_0" in files
    assert "stea_response.json" in files
Exemple #3
0
def test_stea_response(monkeypatch):
    expected_result = {
        "response": [{"TaxMode": "Corporate", "Values": {"NPV": 30}}],
        "profiles": {"a_very_long_string": {"Id": "a_very_long_string"}},
    }
    monkeypatch.setattr(sys, "argv", ["script_name", "-c", "stea_input.yml"])
    fm_stea.main_entry_point()
    with open("stea_response.json", "r") as fin:
        result = json.load(fin)
    assert result == expected_result
Exemple #4
0
def test_stea_ecl_case_overwrite(monkeypatch):
    """
    We want to verify that the ecl_case argument is properly forwarded to stea, but
    there is no ecl_case, so we just assert that we fail with our custom file missing
    """
    monkeypatch.setattr(
        sys,
        "argv",
        ["script_name", "-c", "stea_input.yml", "--ecl_case", "custom_ecl_case"],
    )
    with pytest.raises(
        OSError, match="Failed to create summary instance from argument:custom_ecl_case"
    ):
        fm_stea.main_entry_point()
Exemple #5
0
def test_stea_default_ert_args(monkeypatch):
    """
    We want to verify that the default ert args are correct, so basically that the
    script does not fail.
    """
    monkeypatch.setattr(
        sys,
        "argv",
        [
            "script_name",
            "-c",
            "stea_input.yml",
            "-e",
            "__NONE__",
            "-r",
            "stea_response.json",
        ],
    )
    fm_stea.main_entry_point()