From afaf603c3fae4f37e3d11ebe4327d427f771b8b1 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Tue, 20 Feb 2024 20:16:57 +0100 Subject: [PATCH] update tests --- tests/conftest.py | 2 +- tests/test_cli.py | 7 +++++++ tests/test_renderer.py | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 5a4510b..54b3ce4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -61,7 +61,7 @@ def rendercv_data_model() -> dm.RenderCVDataModel: @pytest.fixture def rendercv_empty_curriculum_vitae_data_model() -> dm.CurriculumVitae: - return dm.CurriculumVitae(name="John Doe") + return dm.CurriculumVitae() @pytest.fixture diff --git a/tests/test_cli.py b/tests/test_cli.py index 2dffbaf..b02b7c0 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -177,6 +177,13 @@ def test_render_command(tmp_path, input_file_path): assert "Your CV is rendered!" in result.stdout +def test_render_command_with_use_local_latex_option(tmp_path, input_file_path): + # copy input file to the temporary directory to create the output directory there: + input_file_path = shutil.copy(input_file_path, tmp_path) + + runner.invoke(cli.app, ["render", str(input_file_path), "--use-local-latex"]) + + def test_new_command(tmp_path): # change the current working directory to the temporary directory: os.chdir(tmp_path) diff --git a/tests/test_renderer.py b/tests/test_renderer.py index 4b11cab..015d9d5 100644 --- a/tests/test_renderer.py +++ b/tests/test_renderer.py @@ -86,7 +86,7 @@ def test_transform_markdown_sections_to_latex_sections(rendercv_data_model): @pytest.mark.parametrize( "string, placeholders, expected_string", [ - ("Hello, {name}!", {"{name}": "World"}, "Hello, World!"), + ("Hello, {name}!", {"{name}": None}, "Hello, World!"), ( "{greeting}, {name}!", {"{greeting}": "Hello", "{name}": "World"}, @@ -188,6 +188,7 @@ def test_make_matched_part_non_line_breakable(value, match_str, expected): ("John Jacob Jingleheimer Schmidt", "J. J. J. Schmidt"), ("SingleName", "SingleName"), ("", ""), + (None, ""), ], ) def test_abbreviate_name(name, expected):