mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-21 23:53:55 +02:00
test(date-ingestion): Cover enrich_company_financials
This commit is contained in:
@ -1,7 +1,36 @@
|
||||
"""Tests for the enrich_company_financials module."""
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pandas as pd
|
||||
|
||||
from aki_prj23_transparenzregister.apps import enrich_company_financials
|
||||
from aki_prj23_transparenzregister.models.auditor import Auditor
|
||||
|
||||
|
||||
def test_import_enrich_company_financials() -> None:
|
||||
"""Testing if the enrich_company_financials can be imported."""
|
||||
assert enrich_company_financials
|
||||
|
||||
|
||||
@patch(
|
||||
"aki_prj23_transparenzregister.apps.enrich_company_financials.Bundesanzeiger.get_information"
|
||||
)
|
||||
@patch(
|
||||
"aki_prj23_transparenzregister.apps.enrich_company_financials.CompanyMongoService"
|
||||
)
|
||||
def test_work(mock_compnay_service: Mock, mock_bundesanzeiger: Mock) -> None:
|
||||
mock_bundesanzeiger.return_value = pd.DataFrame(
|
||||
[
|
||||
{
|
||||
"jahr": "2042",
|
||||
"auditors": [Auditor(name="", company="")],
|
||||
"financial_results": [],
|
||||
}
|
||||
]
|
||||
)
|
||||
# mock_compnay_service.add_yearly_resreturn_value
|
||||
enrich_company_financials.work(
|
||||
{"_id": "", "name": "ABC AG", "location": {"city": "Haltern am See"}},
|
||||
mock_compnay_service,
|
||||
)
|
||||
assert enrich_company_financials
|
||||
|
Reference in New Issue
Block a user