diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_data_models.py b/tests/test_data_models.py index 0b05b94..7ecebbb 100644 --- a/tests/test_data_models.py +++ b/tests/test_data_models.py @@ -1,33 +1,59 @@ -import unittest -import os -import json +import pytest -from rendercv import data_models - -from datetime import date as Date -from pydantic import ValidationError +from rendercv import data_models as dm -def test_sections(): - input = { +@pytest.fixture(scope="module") +def dummy_input(): + return { "name": "John Doe", - "sections": { - "my_section": { - "title": "test", + "sections": None, + } + +# abi burda baya bi senaryo test etmen lazim: +# mesela section icinde title field verilmisse, title o olamli, herseyo overwrite etmeli +# sonra siralama listede verildigi gibi olmali kesinlikle bunu da check et +# sonra default listler alisiyo mu kesinlikle onu check etmek lazim +# bide validation errorleri check etmek lazim + + +def test_education_entry(dummy_input): + dummy_input["sections"] = { + "My Section": [ + { "entry_type": "EducationEntry", "entries": [ { "institution": "Boğaziçi University", + "start_date": "2019-01-01", + "end_date": "2020-01-01", "area": "Mechanical Engineering", - "date": "My Date", } ], } - }, + ] } - - cv = data_models.CurriculumVitae(**input) - assert cv is not None - assert cv.sections[0].entry_type == "EducationEntry" - assert len(cv.sections_input["my_section"].entries) == 1 + cv = dm.CurriculumVitae(**dummy_input) assert cv.sections[0].title == "My Section" + assert len(cv.sections[0].entries) == 1 + + +def test_experience_entry(dummy_input): + dummy_input["sections"] = { + "My Section": [ + { + "entry_type": "ExperienceEntry", + "entries": [ + { + "company": "CERN", + "start_date": "2019-01-01", + "end_date": "2020-01-01", + "position": "Researcher", + } + ], + } + ] + } + cv = dm.CurriculumVitae(**dummy_input) + assert cv.sections[0].title == "My Section" + assert len(cv.sections[0].entries) == 1