more tests, splitting input handling and logic

This commit is contained in:
Pablo Martin 2024-06-06 18:02:43 +02:00
parent afe9e18e0d
commit 46988352ca
4 changed files with 34 additions and 31 deletions

View file

@ -66,7 +66,7 @@ def xe_healthcheck():
"--currencies", default=",".join([]), show_default=True, type=click.STRING
)
@click.option("--dry-run", is_flag=True)
@click.option("--output", type=click.STRING)
@click.option("--output", type=click.STRING, required=True)
def get_rates(
start_date: Union[str, datetime.datetime, datetime.date],
end_date: Union[str, datetime.datetime, datetime.date],
@ -74,10 +74,11 @@ def get_rates(
dry_run: bool,
output: pathlib.Path,
):
handle_get_rates_inputs()
handle_get_rates_inputs(
start_date=start_date,
end_date=end_date,
currencies=currencies,
dry_run=dry_run,
output=output,
)
run_get_rates()
logger.debug(f"Received start_date: {start_date}")
logger.debug(f"Received end_date: {end_date}")
logger.debug(f"Received currencies: {currencies}")
logger.debug(f"dry_run state: {dry_run}")
logger.debug(f"Received output: {output}")

View file

@ -3,5 +3,10 @@ import logging
logger = logging.getLogger()
def handle_get_rates_inputs():
def handle_get_rates_inputs(start_date, end_date, currencies, dry_run, output):
logger.info("Handling inputs.")
logger.debug(f"Received start_date: {start_date}")
logger.debug(f"Received end_date: {end_date}")
logger.debug(f"Received currencies: {currencies}")
logger.debug(f"dry_run state: {dry_run}")
logger.debug(f"Received output: {output}")