Fix CLI tests as config_file path made absolute during CLI parsing

This commit is contained in:
Debanjum Singh Solanky 2022-08-12 01:47:52 +03:00
parent fad2f3a2e7
commit fd952e7273

View file

@ -7,6 +7,7 @@ import pytest
# Internal Packages
from src.utils.cli import cli
from src.utils.helpers import resolve_absolute_path
# Test
@ -16,7 +17,7 @@ def test_cli_minimal_default():
actual_args = cli([])
# Assert
assert actual_args.config_file == Path('~/.khoj/khoj.yml')
assert actual_args.config_file == resolve_absolute_path(Path('~/.khoj/khoj.yml'))
assert actual_args.regenerate == False
assert actual_args.no_gui == False
assert actual_args.verbose == 0
@ -30,7 +31,7 @@ def test_cli_invalid_config_file_path():
actual_args = cli([f'-c={non_existent_config_file}'])
# Assert
assert actual_args.config_file == Path(non_existent_config_file)
assert actual_args.config_file == resolve_absolute_path(non_existent_config_file)
assert actual_args.config == None
# ----------------------------------------------------------------------------------------------------
@ -42,7 +43,7 @@ def test_cli_config_from_file():
'-vvv'])
# Assert
assert actual_args.config_file == Path('tests/data/config.yml')
assert actual_args.config_file == resolve_absolute_path(Path('tests/data/config.yml'))
assert actual_args.no_gui == True
assert actual_args.regenerate == True
assert actual_args.config is not None