fixed
This commit is contained in:
parent
78e3d71b05
commit
15e8b8e513
3 changed files with 24 additions and 2 deletions
|
|
@ -14,6 +14,7 @@ def test_handle_input_rates_works_with_full_correct_inputs():
|
||||||
end_date=datetime.datetime.now() - datetime.timedelta(days=1),
|
end_date=datetime.datetime.now() - datetime.timedelta(days=1),
|
||||||
currencies="USD,EUR,GBP",
|
currencies="USD,EUR,GBP",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
|
rates_source="mock",
|
||||||
ignore_warnings=True,
|
ignore_warnings=True,
|
||||||
output="test_output.csv",
|
output="test_output.csv",
|
||||||
)
|
)
|
||||||
|
|
@ -24,6 +25,7 @@ def test_handle_input_rates_works_with_full_correct_inputs():
|
||||||
),
|
),
|
||||||
"currencies": {Currency("USD"), Currency("EUR"), Currency("GBP")},
|
"currencies": {Currency("USD"), Currency("EUR"), Currency("GBP")},
|
||||||
"dry_run": False,
|
"dry_run": False,
|
||||||
|
"rates_source": "mock",
|
||||||
"ignore_warnings": True,
|
"ignore_warnings": True,
|
||||||
"output": pathlib.Path("test_output.csv"),
|
"output": pathlib.Path("test_output.csv"),
|
||||||
}
|
}
|
||||||
|
|
@ -40,6 +42,20 @@ def test_handle_input_rates_raises_with_bad_currency_code():
|
||||||
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
||||||
currencies="not_a_currency,USD,not_this_either",
|
currencies="not_a_currency,USD,not_this_either",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
|
rates_source="mock",
|
||||||
|
ignore_warnings=True,
|
||||||
|
output="test_output.csv",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_handle_input_rates_raises_with_invalid_rates_source():
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
handle_get_rates_inputs(
|
||||||
|
start_date=datetime.datetime.now(),
|
||||||
|
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
||||||
|
currencies="not_a_currency,USD,not_this_either",
|
||||||
|
dry_run=False,
|
||||||
|
rates_source="clearly not a rates source. I guess, dunno.",
|
||||||
ignore_warnings=True,
|
ignore_warnings=True,
|
||||||
output="test_output.csv",
|
output="test_output.csv",
|
||||||
)
|
)
|
||||||
|
|
@ -52,6 +68,7 @@ def test_handle_input_rates_raises_with_start_date_after_end_date():
|
||||||
end_date=datetime.datetime.now() - datetime.timedelta(days=7),
|
end_date=datetime.datetime.now() - datetime.timedelta(days=7),
|
||||||
currencies="GBP,USD",
|
currencies="GBP,USD",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
|
rates_source="mock",
|
||||||
ignore_warnings=True,
|
ignore_warnings=True,
|
||||||
output="test_output.csv",
|
output="test_output.csv",
|
||||||
)
|
)
|
||||||
|
|
@ -64,6 +81,7 @@ def test_handle_input_rates_raises_with_output_different_than_csv():
|
||||||
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
||||||
currencies="GBP,USD",
|
currencies="GBP,USD",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
|
rates_source="mock",
|
||||||
ignore_warnings=True,
|
ignore_warnings=True,
|
||||||
output="test_output.xlsx",
|
output="test_output.xlsx",
|
||||||
)
|
)
|
||||||
|
|
@ -75,6 +93,7 @@ def test_handle_input_rates_brings_future_end_date_to_today():
|
||||||
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
end_date=datetime.datetime.now() + datetime.timedelta(days=7),
|
||||||
currencies="USD,EUR,GBP",
|
currencies="USD,EUR,GBP",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
|
rates_source="mock",
|
||||||
ignore_warnings=True,
|
ignore_warnings=True,
|
||||||
output="test_output.csv",
|
output="test_output.csv",
|
||||||
)
|
)
|
||||||
|
|
@ -88,6 +107,7 @@ def test_handle_input_rates_start_and_end_date_equal_works_fine():
|
||||||
end_date=datetime.datetime.now(),
|
end_date=datetime.datetime.now(),
|
||||||
currencies="USD,EUR,GBP",
|
currencies="USD,EUR,GBP",
|
||||||
dry_run=False,
|
dry_run=False,
|
||||||
|
rates_source="mock",
|
||||||
ignore_warnings=True,
|
ignore_warnings=True,
|
||||||
output="test_output.csv",
|
output="test_output.csv",
|
||||||
)
|
)
|
||||||
|
|
@ -98,6 +118,7 @@ def test_handle_input_rates_start_and_end_date_equal_works_fine():
|
||||||
),
|
),
|
||||||
"currencies": {Currency("USD"), Currency("EUR"), Currency("GBP")},
|
"currencies": {Currency("USD"), Currency("EUR"), Currency("GBP")},
|
||||||
"dry_run": False,
|
"dry_run": False,
|
||||||
|
"rates_source": "mock",
|
||||||
"ignore_warnings": True,
|
"ignore_warnings": True,
|
||||||
"output": pathlib.Path("test_output.csv"),
|
"output": pathlib.Path("test_output.csv"),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ def get_rates(
|
||||||
end_date: Union[str, datetime.datetime, datetime.date],
|
end_date: Union[str, datetime.datetime, datetime.date],
|
||||||
currencies: Union[None, str],
|
currencies: Union[None, str],
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
rates_sources: str,
|
rates_source: str,
|
||||||
ignore_warnings: bool,
|
ignore_warnings: bool,
|
||||||
output: pathlib.Path,
|
output: pathlib.Path,
|
||||||
):
|
):
|
||||||
|
|
@ -83,7 +83,7 @@ def get_rates(
|
||||||
end_date=end_date,
|
end_date=end_date,
|
||||||
currencies=currencies,
|
currencies=currencies,
|
||||||
dry_run=dry_run,
|
dry_run=dry_run,
|
||||||
rates_sources=rates_sources,
|
rates_source=rates_source,
|
||||||
ignore_warnings=ignore_warnings,
|
ignore_warnings=ignore_warnings,
|
||||||
output=output,
|
output=output,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ def run_get_rates(
|
||||||
date_range: DateRange,
|
date_range: DateRange,
|
||||||
currencies: List[Currency],
|
currencies: List[Currency],
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
|
rates_source: str,
|
||||||
ignore_warnings: bool,
|
ignore_warnings: bool,
|
||||||
output: pathlib.Path,
|
output: pathlib.Path,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue