mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-22 00:23:55 +02:00
fix: Add script to fix malformed yearly_result entries
This commit is contained in:
@ -160,3 +160,35 @@ def test_add_yearly_reslults(mock_mongo_connector: Mock, mock_collection: Mock)
|
||||
mock_result: list = [{"_id": "abc", "brille?": "Fielmann", "Hotel?": "Trivago"}]
|
||||
mock_collection.update_one.return_value = mock_result
|
||||
assert service.add_yearly_results("612316a1e198338c3b44299e", {}) == mock_result
|
||||
|
||||
|
||||
def test_get_where_malformed_yearly_results(
|
||||
mock_mongo_connector: Mock, mock_collection: Mock
|
||||
) -> None:
|
||||
mock_mongo_connector.database = {"companies": mock_collection}
|
||||
service = CompanyMongoService(mock_mongo_connector)
|
||||
mock_result: list = [
|
||||
{
|
||||
"_id": "abc",
|
||||
"name": "Fielmann",
|
||||
"Hotel?": "Trivago",
|
||||
"yearly_results": {"Vor Aeonen": 42, "2022": 4711},
|
||||
},
|
||||
{
|
||||
"_id": "abc",
|
||||
"name": "Fielmann",
|
||||
"Hotel?": "Trivago",
|
||||
"yearly_results": {"1998": 42, "2022": 4711},
|
||||
},
|
||||
{
|
||||
"_id": "abc",
|
||||
"name": "Fielmann",
|
||||
"Hotel?": "Trivago",
|
||||
"yearly_results": {"19": 42, "2022": 4711},
|
||||
},
|
||||
]
|
||||
mock_collection.find.return_value = mock_result
|
||||
assert service.get_where_malformed_yearly_results() == [
|
||||
mock_result[0],
|
||||
mock_result[2],
|
||||
]
|
||||
|
Reference in New Issue
Block a user