mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-24 17:12:34 +02:00
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""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
|