mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-25 16:42:34 +02:00
Adds the financial graph to the company page. The graph is only available for companies with existing financial data.
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.models.company import FinancialKPIEnum
|
|
from aki_prj23_transparenzregister.ui import data_elements, finance_elements
|
|
|
|
|
|
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)
|