From 1d1d45f39dd1b49ab22f3eed5d53326fe01228e1 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Fri, 26 Jan 2024 19:48:08 +0100 Subject: [PATCH] improve data model tests --- tests/test_data_models.py | 171 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/tests/test_data_models.py b/tests/test_data_models.py index 7ecebbb..79b8bac 100644 --- a/tests/test_data_models.py +++ b/tests/test_data_models.py @@ -10,11 +10,182 @@ def dummy_input(): "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 +# REPLACEWITHTODAY olayini monkeypatch ile duzelticeksin, hep statik bir tarih return etsin + + +def test_sections(dummy_input): + dummy_input["sections"] = { + "My Section 1": { + "entry_type": "EducationEntry", + "entries": [ + { + "institution": "Boğaziçi University", + "area": "Mechanical Engineering", + } + ], + }, + "My Section 2": { + "entry_type": "ExperienceEntry", + "entries": [ + { + "company": "Apple", + "position": "Researcher", + } + ], + }, + "My Section 3": { + "entry_type": "PublicationEntry", + "entries": [ + { + "title": "My Title", + "authors": ["John Doe", "Jane Doe"], + "doi": "10.1109/TASC.2023.3340648", + "date": "2023-12-08", + } + ], + }, + "my_section_4": { + "entry_type": "NormalEntry", + "entries": [ + { + "name": "My Entry", + } + ], + }, + "my_section_5": { + "entry_type": "OneLineEntry", + "entries": [ + { + "name": "My One Line Entry", + "details": "My Details", + } + ], + }, + "my_section_6": { + "entry_type": "TextEntry", + "entries": ["My Text Entry"], + }, + "Education": [ + { + "institution": "Boğaziçi University", + "area": "Mechanical Engineering", + } + ], + "Experience": [ + { + "company": "Apple", + "position": "Researcher", + } + ], + "Work Experience": [ + { + "company": "Apple", + "position": "Researcher", + } + ], + "Research Experience": [ + { + "company": "Apple", + "position": "Researcher", + } + ], + "Publications": [ + { + "title": "My Title", + "authors": ["John Doe", "Jane Doe"], + "doi": "10.1109/TASC.2023.3340648", + "date": "2023-12-08", + } + ], + "Papers": [ + { + "title": "My Title", + "authors": ["John Doe", "Jane Doe"], + "doi": "10.1109/TASC.2023.3340648", + "date": "2023-12-08", + } + ], + "Projects": [ + { + "name": "My Entry", + } + ], + "Academic Projects": [ + { + "name": "My Entry", + } + ], + "University Projects": [ + { + "name": "My Entry", + } + ], + "Personal Projects": [ + { + "name": "My Entry", + } + ], + "Certificates": [ + { + "name": "My Entry", + } + ], + "Extracurricular Activities": [ + { + "company": "Apple", + "position": "Researcher", + } + ], + "Test Scores": [ + { + "name": "My One Line Entry", + "details": "My Details", + } + ], + "Skills": [ + { + "name": "My One Line Entry", + "details": "My Details", + } + ], + "Programming Skills": [ + { + "name": "My Entry", + } + ], + "Other Skills": [ + { + "name": "My One Line Entry", + "details": "My Details", + } + ], + "Awards": [ + { + "name": "My One Line Entry", + "details": "My Details", + } + ], + "Interests": [ + { + "name": "My One Line Entry", + "details": "My Details", + } + ], + "Summary": ["My Text Entry"], + } + + cv = dm.CurriculumVitae(**dummy_input) + assert len(cv.sections) == 22 + + titles = [section.title for section in cv.sections] + for key in dummy_input["sections"]: + assert key in titles def test_education_entry(dummy_input):