2024-01-18 22:38:19 +00:00
|
|
|
import pytest
|
2024-01-18 17:24:30 +00:00
|
|
|
|
2024-01-18 22:38:19 +00:00
|
|
|
from rendercv import data_models as dm
|
2024-01-18 17:24:30 +00:00
|
|
|
|
|
|
|
|
2024-01-18 22:38:19 +00:00
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def dummy_input():
|
|
|
|
return {
|
2024-01-18 17:24:30 +00:00
|
|
|
"name": "John Doe",
|
2024-01-18 22:38:19 +00:00
|
|
|
"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": [
|
|
|
|
{
|
2024-01-18 17:24:30 +00:00
|
|
|
"entry_type": "EducationEntry",
|
|
|
|
"entries": [
|
|
|
|
{
|
|
|
|
"institution": "Boğaziçi University",
|
2024-01-18 22:38:19 +00:00
|
|
|
"start_date": "2019-01-01",
|
|
|
|
"end_date": "2020-01-01",
|
2024-01-18 17:24:30 +00:00
|
|
|
"area": "Mechanical Engineering",
|
|
|
|
}
|
|
|
|
],
|
|
|
|
}
|
2024-01-18 22:38:19 +00:00
|
|
|
]
|
2024-01-18 17:24:30 +00:00
|
|
|
}
|
2024-01-18 22:38:19 +00:00
|
|
|
cv = dm.CurriculumVitae(**dummy_input)
|
|
|
|
assert cv.sections[0].title == "My Section"
|
|
|
|
assert len(cv.sections[0].entries) == 1
|
|
|
|
|
2024-01-18 17:24:30 +00:00
|
|
|
|
2024-01-18 22:38:19 +00:00
|
|
|
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)
|
2024-01-18 17:24:30 +00:00
|
|
|
assert cv.sections[0].title == "My Section"
|
2024-01-18 22:38:19 +00:00
|
|
|
assert len(cv.sections[0].entries) == 1
|