mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-05-13 09:58:47 +02:00
test: Introducing first unit tests of new Company and News model
This commit is contained in:
parent
52d7f62bbe
commit
9da3e4adb9
35
tests/models/company_test.py
Normal file
35
tests/models/company_test.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"""Test Models.company."""
|
||||||
|
|
||||||
|
|
||||||
|
from aki_prj23_transparenzregister.models.company import Company, CompanyID, Location
|
||||||
|
|
||||||
|
|
||||||
|
def test_to_dict() -> None:
|
||||||
|
"""Tests if the version tag is entered."""
|
||||||
|
company_id = CompanyID("The Shire", "420")
|
||||||
|
location = Location(
|
||||||
|
city="Insmouth", house_number="19", street="Harbor", zip_code="1890"
|
||||||
|
)
|
||||||
|
company = Company(
|
||||||
|
id=company_id,
|
||||||
|
last_update="Tomorrow",
|
||||||
|
location=location,
|
||||||
|
name="BLANK GmbH",
|
||||||
|
relationships=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
assert company.to_dict() == {
|
||||||
|
"id": {
|
||||||
|
"district_court": company_id.district_court,
|
||||||
|
"hr_number": company_id.hr_number,
|
||||||
|
},
|
||||||
|
"last_update": company.last_update,
|
||||||
|
"location": {
|
||||||
|
"city": location.city,
|
||||||
|
"house_number": location.house_number,
|
||||||
|
"street": location.street,
|
||||||
|
"zip_code": location.zip_code,
|
||||||
|
},
|
||||||
|
"name": "BLANK GmbH",
|
||||||
|
"relationships": [],
|
||||||
|
}
|
23
tests/models/news_test.py
Normal file
23
tests/models/news_test.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
"""Test Models.nes."""
|
||||||
|
|
||||||
|
|
||||||
|
from aki_prj23_transparenzregister.models.news import News
|
||||||
|
|
||||||
|
|
||||||
|
def test_to_dict() -> None:
|
||||||
|
"""Tests if the version tag is entered."""
|
||||||
|
news = News(
|
||||||
|
"4711",
|
||||||
|
"Economy collapses",
|
||||||
|
"2042",
|
||||||
|
"Toilet paper prices rising",
|
||||||
|
"https://www.google.com",
|
||||||
|
)
|
||||||
|
|
||||||
|
assert news.to_dict() == {
|
||||||
|
"id": news.id,
|
||||||
|
"title": news.title,
|
||||||
|
"date": news.date,
|
||||||
|
"text": news.text,
|
||||||
|
"source_url": news.source_url,
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user