mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-22 16:12:55 +02:00
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
"""Tests for finance ui elements."""
|
|
|
|
import pandas as pd
|
|
from sqlalchemy.orm import Session
|
|
|
|
from aki_prj23_transparenzregister.ui import data_elements, finance_elements
|
|
from aki_prj23_transparenzregister.utils.enum_types import FinancialKPIEnum
|
|
|
|
|
|
def test_financial_metrics_layout(full_db: Session) -> None:
|
|
"""Checks if the financial metric layout of the company page can be created."""
|
|
selected_company_id = 1
|
|
finance_elements.financial_metrics_layout(full_db, selected_company_id)
|
|
|
|
|
|
def test_complete_metrics() -> None:
|
|
"""Tests if names for all the FinancialKPIEnum are there."""
|
|
assert set(finance_elements.METRICS.keys()).issubset(
|
|
{_.value for _ in FinancialKPIEnum}
|
|
)
|
|
|
|
|
|
def test_update_figure(full_db: Session) -> None:
|
|
"""Checks if the output after choosing a metric can be updated."""
|
|
company_id = 1
|
|
value = "equity"
|
|
data = data_elements.get_finance_data_of_one_company(full_db, company_id).to_json(
|
|
date_format="iso"
|
|
)
|
|
finance_elements.update_figure(value, data)
|
|
|
|
|
|
def test_finance_figure(full_db: Session) -> None:
|
|
"""Checks if the financial graph can be created."""
|
|
company_id = 1
|
|
metric = "equity"
|
|
data = data_elements.get_finance_data_of_one_company(full_db, company_id)
|
|
selected_finance_df = pd.DataFrame(data)
|
|
finance_elements.financials_figure(selected_finance_df, metric)
|