mirror of https://github.com/eyhc1/rendercv.git
moving from unittest to pytest
This commit is contained in:
parent
b5b0e284e2
commit
2e54d762dc
|
@ -1,33 +1,59 @@
|
||||||
import unittest
|
import pytest
|
||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
from rendercv import data_models
|
from rendercv import data_models as dm
|
||||||
|
|
||||||
from datetime import date as Date
|
|
||||||
from pydantic import ValidationError
|
|
||||||
|
|
||||||
|
|
||||||
def test_sections():
|
@pytest.fixture(scope="module")
|
||||||
input = {
|
def dummy_input():
|
||||||
|
return {
|
||||||
"name": "John Doe",
|
"name": "John Doe",
|
||||||
"sections": {
|
"sections": None,
|
||||||
"my_section": {
|
}
|
||||||
"title": "test",
|
|
||||||
|
# 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",
|
"entry_type": "EducationEntry",
|
||||||
"entries": [
|
"entries": [
|
||||||
{
|
{
|
||||||
"institution": "Boğaziçi University",
|
"institution": "Boğaziçi University",
|
||||||
|
"start_date": "2019-01-01",
|
||||||
|
"end_date": "2020-01-01",
|
||||||
"area": "Mechanical Engineering",
|
"area": "Mechanical Engineering",
|
||||||
"date": "My Date",
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
}
|
}
|
||||||
|
cv = dm.CurriculumVitae(**dummy_input)
|
||||||
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
|
|
||||||
assert cv.sections[0].title == "My Section"
|
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
|
||||||
|
|
Loading…
Reference in New Issue