tests: add more tests

This commit is contained in:
Sina Atalay 2024-02-25 15:15:54 +01:00
parent 07f0dcf52d
commit 80269cfb01
4 changed files with 16 additions and 2 deletions

View File

@ -93,11 +93,20 @@ def test_read_input_file_invalid_file(tmp_path):
dm.read_input_file(invalid_file_path) dm.read_input_file(invalid_file_path)
def test_get_a_sample_data_model(): @pytest.mark.parametrize(
data_model = dm.get_a_sample_data_model("John Doe") "theme",
dm.available_themes,
)
def test_get_a_sample_data_model(theme):
data_model = dm.get_a_sample_data_model("John Doe", theme)
assert isinstance(data_model, dm.RenderCVDataModel) assert isinstance(data_model, dm.RenderCVDataModel)
def test_get_a_sample_data_model_invalid_theme():
with pytest.raises(ValueError):
dm.get_a_sample_data_model("John Doe", "invalid")
def test_generate_json_schema(): def test_generate_json_schema():
schema = dm.generate_json_schema() schema = dm.generate_json_schema()
assert isinstance(schema, dict) assert isinstance(schema, dict)

View File

@ -416,6 +416,11 @@ def test_copy_theme_files_to_output_directory_custom_theme(
pathlib.Path(custom_theme_directory_path / "theme_auxiliary_dir").mkdir( pathlib.Path(custom_theme_directory_path / "theme_auxiliary_dir").mkdir(
exist_ok=True exist_ok=True
) )
pathlib.Path(
custom_theme_directory_path
/ "theme_auxiliary_dir"
/ "theme_auxiliary_file.txt"
).touch()
init_file = pathlib.Path(custom_theme_directory_path / "__init__.py") init_file = pathlib.Path(custom_theme_directory_path / "__init__.py")
init_file.touch() init_file.touch()