2021-08-22 04:21:38 +02:00
|
|
|
# Standard Modules
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
# Internal Packages
|
2021-09-30 13:12:14 +02:00
|
|
|
from src.utils.cli import cli
|
2021-08-22 04:21:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Test
|
|
|
|
# ----------------------------------------------------------------------------------------------------
|
|
|
|
def test_cli_minimal_default():
|
|
|
|
# Act
|
|
|
|
actual_args = cli(['--config-file=tests/data/config.yml'])
|
|
|
|
|
|
|
|
# Assert
|
|
|
|
assert actual_args.config_file == Path('tests/data/config.yml')
|
|
|
|
assert actual_args.regenerate == False
|
|
|
|
assert actual_args.verbose == 0
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------------------------------
|
|
|
|
def test_cli_flags():
|
|
|
|
# Act
|
|
|
|
actual_args = cli(['--config-file=tests/data/config.yml',
|
|
|
|
'--regenerate',
|
|
|
|
'-vvv'])
|
|
|
|
|
|
|
|
# Assert
|
|
|
|
assert actual_args.config_file == Path('tests/data/config.yml')
|
|
|
|
assert actual_args.regenerate == True
|
|
|
|
assert actual_args.verbose == 3
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------------------------------
|
|
|
|
def test_cli_config_from_file():
|
|
|
|
# Act
|
|
|
|
actual_args = cli(['--config-file=tests/data/config.yml',
|
|
|
|
'--regenerate',
|
|
|
|
'-vvv'])
|
|
|
|
|
|
|
|
# Assert
|
|
|
|
assert actual_args.config_file == Path('tests/data/config.yml')
|
|
|
|
assert actual_args.regenerate == True
|
|
|
|
assert actual_args.config is not None
|
2022-08-04 22:26:31 +02:00
|
|
|
assert actual_args.config.content_type.org.input_files == [Path('~/first_from_config.org'), Path('~/second_from_config.org')]
|
2021-08-22 04:21:38 +02:00
|
|
|
assert actual_args.verbose == 3
|