mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-21 23:43:55 +02:00
Added location to person (#185)
This commit is contained in:
@ -135,25 +135,52 @@ def test_get_district_court_id(name: str, city: str, id: int, full_db: Session)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("firstname", "surname", "date_str", "id"),
|
||||
("firstname", "surname", "date_str", "location", "id"),
|
||||
[
|
||||
("Max", "Mustermann", "2023-01-01", 1),
|
||||
("Sabine", "Mustermann", "2023-01-01", 2),
|
||||
("Some Firstname", "Some Surname", "2023-01-01", 3),
|
||||
("Some Firstname", "Some Surname", "2023-01-02", 4),
|
||||
("Other Firstname", "Other Surname", "2023-01-02", 5),
|
||||
("Does not exist", "Other Surname", "2023-01-02", 6),
|
||||
("Other Firstname", "Does not exists", "2023-01-02", 6),
|
||||
("Other Firstname", "Other Surname", "1900-01-02", 6),
|
||||
("Max", "Mustermann", "2023-01-01", {"zip_code": "58644"}, 1),
|
||||
("Sabine", "Mustermann", "2023-01-01", {}, 2),
|
||||
("Some Firstname", "Some Surname", "2023-01-01", {}, 3),
|
||||
("Some Firstname", "Some Surname", "2023-01-02", {}, 4),
|
||||
(
|
||||
"Other Firstname",
|
||||
"Other Surname",
|
||||
"2023-01-02",
|
||||
{
|
||||
"zip_code": "58636",
|
||||
"city": "Iserlohn",
|
||||
"street": "Sesamstraße",
|
||||
"house_number": "62",
|
||||
},
|
||||
5,
|
||||
),
|
||||
("Does not exist", "Other Surname", "2023-01-02", {}, 6),
|
||||
(
|
||||
"Other Firstname",
|
||||
"Does not exists",
|
||||
"2023-01-02",
|
||||
{
|
||||
"zip_code": "58636",
|
||||
"city": "Iserlohn",
|
||||
"street": "Sesamstraße",
|
||||
"house_number": "62",
|
||||
},
|
||||
6,
|
||||
),
|
||||
("Other Firstname", "Other Surname", "1900-01-02", {"zip_code": "58644"}, 6),
|
||||
],
|
||||
)
|
||||
def test_get_person_id(
|
||||
firstname: str, surname: str, date_str: str, id: int, full_db: Session
|
||||
firstname: str,
|
||||
surname: str,
|
||||
date_str: str,
|
||||
location: dict,
|
||||
id: int,
|
||||
full_db: Session,
|
||||
) -> None:
|
||||
"""Tests if a person id can be returned and the court automatically be added if not yet part of the db."""
|
||||
assert (
|
||||
data_transfer.get_person_id(
|
||||
firstname, surname, date.fromisoformat(date_str), full_db
|
||||
firstname, surname, date.fromisoformat(date_str), location, full_db
|
||||
)
|
||||
== id
|
||||
)
|
||||
@ -178,6 +205,7 @@ def test_get_person_id_value_check(
|
||||
firstname,
|
||||
surname,
|
||||
date.fromisoformat(date_str) if date_str else None,
|
||||
{},
|
||||
full_db,
|
||||
)
|
||||
|
||||
@ -640,33 +668,39 @@ def test_add_relationships_none(empty_relations: list, full_db: Session) -> None
|
||||
{
|
||||
"name": {"firstname": "Second person", "lastname": "Köstser"},
|
||||
"date_of_birth": "1961-02-09",
|
||||
"location": {"city": "Stuttgart"},
|
||||
"location": {"city": "Stuttgart", "house_number": "4"},
|
||||
"role": "Geschäftsführer",
|
||||
"type": CompanyRelationshipEnum.PERSON.value,
|
||||
},
|
||||
{
|
||||
"name": {"firstname": "First Person", "lastname": "Jifpa"},
|
||||
"date_of_birth": "1976-04-20",
|
||||
"location": {"city": "Stuttgart"},
|
||||
"location": {
|
||||
"city": "Stuttgart",
|
||||
"street": "Sesamstraße",
|
||||
"zip_code": "64287",
|
||||
"house_number": "4",
|
||||
},
|
||||
"role": "Geschäftsführer",
|
||||
"type": CompanyRelationshipEnum.PERSON.value,
|
||||
},
|
||||
{
|
||||
"name": {"firstname": "", "lastname": "Jiapa"},
|
||||
"date_of_birth": "1976-04-20",
|
||||
"location": {"city": "Stuttgart"},
|
||||
"location": {"city": "Stuttgart", "house_number": "5"},
|
||||
"role": "Geschäftsführer",
|
||||
"type": CompanyRelationshipEnum.PERSON.value,
|
||||
},
|
||||
{
|
||||
"name": {"firstname": "Something", "lastname": ""},
|
||||
"date_of_birth": "12i3u",
|
||||
"location": {"city": "Stuttgart"},
|
||||
"location": {"city": "Stuttgart", "house_number": "4"},
|
||||
"role": "Geschäftsführer",
|
||||
"type": CompanyRelationshipEnum.PERSON.value,
|
||||
},
|
||||
{
|
||||
"name": {"lastname": "Jipha"},
|
||||
"location": {"city": "Stuttgart"},
|
||||
"date_of_birth": "1976-04-20",
|
||||
"type": CompanyRelationshipEnum.PERSON.value,
|
||||
},
|
||||
@ -697,7 +731,7 @@ def test_relationships(documents: list[dict[str, Any]], full_db: Session) -> Non
|
||||
"founding_date": {0: pd.Timestamp(date.fromisoformat("2010-08-07"))},
|
||||
"business_purpose": {0: 'Say "Hello World"', 1: "Some purpose"},
|
||||
"street": {0: "Sesamstr.", 1: "Sesamstr.", 2: None},
|
||||
"house_number": {0: "4", 1: "8"},
|
||||
"house_number": {0: "1", 1: "2"},
|
||||
"zip_code": {0: "58644", 1: "58636"},
|
||||
"city": {0: "TV City", 1: "TV City"},
|
||||
"longitude": {0: 7.6968, 1: 7.7032},
|
||||
@ -765,6 +799,13 @@ def test_relationships(documents: list[dict[str, Any]], full_db: Session) -> Non
|
||||
6: pd.Timestamp("1976-04-20 00:00:00"),
|
||||
},
|
||||
"works_for": {_: None for _ in range(7)},
|
||||
"street": {6: "Sesamstraße"},
|
||||
"house_number": {5: "4", 6: "4"},
|
||||
"zip_code": {6: "64287"},
|
||||
"city": {5: "Stuttgart", 6: "Stuttgart"},
|
||||
"longitude": {6: 8.6644},
|
||||
"latitude": {6: 49.8676},
|
||||
"pos_accuracy": {6: 4.0},
|
||||
}
|
||||
),
|
||||
)
|
||||
|
Reference in New Issue
Block a user