mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-08-11 19:18:28 +02:00
175 create person page (#178)
Created person page and updated search bar in the header to search for persons
This commit is contained in:
@@ -31,9 +31,9 @@ def test_go_to_home() -> None:
|
||||
assert output == "/"
|
||||
|
||||
|
||||
def test_go_to_company_page() -> None:
|
||||
"""Checks if the go_to_company_page callback yields a result."""
|
||||
output = app.go_to_company_page(1)
|
||||
def test_go_to_detail_page() -> None:
|
||||
"""Checks if the go_to_detail_page callback yields a result."""
|
||||
output = app.go_to_detail_page("c_1")
|
||||
assert output == "/Unternehmensdetails/1"
|
||||
|
||||
|
||||
|
38
tests/ui/company_elements_test.py
Normal file
38
tests/ui/company_elements_test.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Tests for company elements."""
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aki_prj23_transparenzregister.ui import company_elements, data_elements
|
||||
|
||||
|
||||
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(selected_company_stats)
|
||||
|
||||
|
||||
def test_create_tabs(full_db: Session) -> None:
|
||||
"""Checks if the tabs of the company page can be created."""
|
||||
selected_company_id = 1
|
||||
finance_df = data_elements.get_finance_data(full_db)
|
||||
selected_finance_df = finance_df.loc[
|
||||
finance_df["company_id"] == selected_company_id
|
||||
]
|
||||
company_elements.create_tabs(selected_company_id, selected_finance_df)
|
||||
|
||||
|
||||
def test_kennzahlen_layout(full_db: Session) -> None:
|
||||
"""Checks if the financial metric layout of the company page can be created."""
|
||||
selected_company_id = 1
|
||||
finance_df = data_elements.get_finance_data(full_db)
|
||||
selected_finance_df = finance_df.loc[
|
||||
finance_df["company_id"] == selected_company_id
|
||||
]
|
||||
company_elements.kennzahlen_layout(selected_finance_df)
|
@@ -1,7 +0,0 @@
|
||||
"""Test for the company stats dashboard."""
|
||||
from aki_prj23_transparenzregister.ui import company_finance_dash
|
||||
|
||||
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co company_stats_dash can be made."""
|
||||
assert company_finance_dash is not None
|
@@ -1,19 +1,19 @@
|
||||
"""Tests for ui elements."""
|
||||
"""Tests for data elements."""
|
||||
|
||||
import pandas as pd
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aki_prj23_transparenzregister.ui import ui_elements
|
||||
from aki_prj23_transparenzregister.ui import data_elements
|
||||
|
||||
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co ui_elements can be made."""
|
||||
assert ui_elements is not None
|
||||
assert data_elements is not None
|
||||
|
||||
|
||||
def test_get_company_data(full_db: Session) -> None:
|
||||
"""Checks if data from the company and district court tables can be accessed."""
|
||||
company_df = ui_elements.get_company_data(full_db)
|
||||
company_df = data_elements.get_company_data(full_db)
|
||||
|
||||
test_data = pd.DataFrame(
|
||||
{
|
||||
@@ -50,7 +50,7 @@ def test_get_company_data(full_db: Session) -> None:
|
||||
|
||||
def test_get_finance_data(full_db: Session) -> None:
|
||||
"""Checks if data from the company and finance tables can be accessed."""
|
||||
finance_df = ui_elements.get_finance_data(full_db)
|
||||
finance_df = data_elements.get_finance_data(full_db)
|
||||
test_data = pd.DataFrame(
|
||||
{
|
||||
"annual_finance_statement_id": {0: 1, 1: 2},
|
||||
@@ -79,43 +79,3 @@ def test_get_finance_data(full_db: Session) -> None:
|
||||
}
|
||||
)
|
||||
pd.testing.assert_frame_equal(finance_df, test_data)
|
||||
|
||||
|
||||
def test_create_header() -> None:
|
||||
"""Checks if the header can be created."""
|
||||
options = {1: "a", 2: "b"}
|
||||
ui_elements.create_header(options)
|
||||
|
||||
|
||||
def test_create_company_header() -> None:
|
||||
"""Checks if the company header can be created."""
|
||||
selected_company = "Test GmbH"
|
||||
ui_elements.create_company_header(selected_company)
|
||||
|
||||
|
||||
def test_create_company_stats(full_db: Session) -> None:
|
||||
"""Checks if the company widgets can be created."""
|
||||
company_df = ui_elements.get_company_data(full_db)
|
||||
value_chosen = 1
|
||||
selected_company_stats = company_df.loc[value_chosen]
|
||||
ui_elements.create_company_stats(selected_company_stats)
|
||||
|
||||
|
||||
def test_create_tabs(full_db: Session) -> None:
|
||||
"""Checks if the tabs of the company page can be created."""
|
||||
selected_company_id = 1
|
||||
finance_df = ui_elements.get_finance_data(full_db)
|
||||
selected_finance_df = finance_df.loc[
|
||||
finance_df["company_id"] == selected_company_id
|
||||
]
|
||||
ui_elements.create_tabs(selected_company_id, selected_finance_df)
|
||||
|
||||
|
||||
def test_kennzahlen_layout(full_db: Session) -> None:
|
||||
"""Checks if the financial metric layout of the company page can be created."""
|
||||
selected_company_id = 1
|
||||
finance_df = ui_elements.get_finance_data(full_db)
|
||||
selected_finance_df = finance_df.loc[
|
||||
finance_df["company_id"] == selected_company_id
|
||||
]
|
||||
ui_elements.kennzahlen_layout(selected_finance_df)
|
20
tests/ui/header_elements_test.py
Normal file
20
tests/ui/header_elements_test.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""Tests for header elements."""
|
||||
|
||||
from aki_prj23_transparenzregister.ui import header_elements
|
||||
|
||||
|
||||
def test_import() -> None:
|
||||
"""Checks if an import co ui_elements can be made."""
|
||||
assert header_elements is not None
|
||||
|
||||
|
||||
def test_create_header() -> None:
|
||||
"""Checks if the header can be created."""
|
||||
options = {1: "a", 2: "b"}
|
||||
header_elements.create_header(options)
|
||||
|
||||
|
||||
def test_create_selection_header() -> None:
|
||||
"""Checks if the company header can be created."""
|
||||
selected_company = "Test GmbH"
|
||||
header_elements.create_selection_header(selected_company)
|
27
tests/ui/person_page_test.py
Normal file
27
tests/ui/person_page_test.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Tests for the person page dashboard."""
|
||||
from collections.abc import Generator
|
||||
|
||||
import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from aki_prj23_transparenzregister.ui.pages import person
|
||||
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 of the company page can be made."""
|
||||
assert person is not None
|
||||
|
||||
|
||||
def test_layout() -> None:
|
||||
"""Checks if the company page can be created."""
|
||||
selected_company_id = "2"
|
||||
person.layout(selected_company_id)
|
Reference in New Issue
Block a user