mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-22 22:22:54 +02:00
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Tests for company elements."""
|
|
|
|
from collections.abc import Generator
|
|
|
|
import pytest
|
|
from sqlalchemy.orm import Session
|
|
|
|
from aki_prj23_transparenzregister.ui import company_elements, data_elements
|
|
from aki_prj23_transparenzregister.ui.session_handler import SessionHandler
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _set_session(full_db: Session) -> Generator[None, None, None]:
|
|
"""Sets a session for the dash application to be used."""
|
|
SessionHandler.session = full_db
|
|
yield
|
|
SessionHandler.session = None
|
|
|
|
|
|
def test_import() -> None:
|
|
"""Checks if an import co ui_elements can be made."""
|
|
assert company_elements is not None
|
|
|
|
|
|
def test_create_company_stats(full_db: Session) -> None:
|
|
"""Checks if the company widgets can be created."""
|
|
company_df = data_elements.get_company_data(full_db)
|
|
value_chosen = 1
|
|
selected_company_stats = company_df.loc[value_chosen]
|
|
company_elements.create_company_stats(value_chosen, selected_company_stats, full_db)
|
|
|
|
|
|
def test_create_tabs(full_db: Session) -> None:
|
|
"""Checks if the tabs of the company page can be created."""
|
|
selected_company_id = 1
|
|
company_elements.create_tabs(full_db, selected_company_id)
|