feat: Quickstart, Benutzerverwaltung und Orion-Ergebnisbox
This commit is contained in:
parent
4f669a3426
commit
e9e46f2cb4
404 changed files with 1032 additions and 600 deletions
|
|
@ -27,6 +27,7 @@ from app.schemas.auth import LoginRequest
|
|||
from app.schemas.domain import QuickStartCreateRequest, UserCreate, UserUpdate, ValidationCreate
|
||||
from app.modules.orion.service import OrionReportService
|
||||
from app.modules.orion.assets import SCHUBAMED_LOGO_PATH, schubamed_logo_uri
|
||||
from app.modules.orion.result import validation_result_box, validation_result_presentation
|
||||
from app.modules.orion.template_service import REPORT_SECTIONS, ReportTemplateService
|
||||
from app.modules.helios.service import HeliosImportService
|
||||
|
||||
|
|
@ -124,6 +125,46 @@ def test_search_finds_report_number():
|
|||
assert result["total"] == 1
|
||||
|
||||
|
||||
def test_result_filter_accepts_canonical_values_for_legacy_rows():
|
||||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
validation = valid_validation(customer, location, device)
|
||||
validation.result = "mit_auflagen"
|
||||
db.add(validation)
|
||||
db.commit()
|
||||
|
||||
result = ValidationWorkflowService(db).query_validations(
|
||||
search=None,
|
||||
page=1,
|
||||
page_size=20,
|
||||
sort_by="updated_at",
|
||||
sort_order="desc",
|
||||
filters={"result": "BESTANDEN_MIT_AUFLAGEN"},
|
||||
)
|
||||
|
||||
assert result["total"] == 1
|
||||
assert result["items"][0].id == validation.id
|
||||
|
||||
|
||||
def test_dashboard_exposes_validation_result_counts():
|
||||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
values = ["BESTANDEN", "mit_auflagen", "nicht_bestanden", "offen"]
|
||||
for index, result_value in enumerate(values, start=1):
|
||||
validation = valid_validation(customer, location, device)
|
||||
validation.report_number = f"VAL-RESULT-{index}"
|
||||
validation.result = result_value
|
||||
db.add(validation)
|
||||
db.commit()
|
||||
|
||||
payload = domain_api.dashboard(session=db)
|
||||
|
||||
assert payload["validation_result_passed"] == 1
|
||||
assert payload["validation_result_conditional"] == 1
|
||||
assert payload["validation_result_failed"] == 1
|
||||
assert payload["validation_result_open"] == 1
|
||||
|
||||
|
||||
def test_csv_import_preview_detects_duplicate_and_missing_fields():
|
||||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
|
|
@ -837,6 +878,7 @@ def test_orion_renders_reference_main_chapters(tmp_path):
|
|||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
validation = valid_validation(customer, location, device)
|
||||
validation.result = "BESTANDEN"
|
||||
db.add(validation)
|
||||
db.flush()
|
||||
|
||||
|
|
@ -848,6 +890,52 @@ def test_orion_renders_reference_main_chapters(tmp_path):
|
|||
assert "9 Werkskalibrierzertifikate Sensoren" in html
|
||||
|
||||
|
||||
def test_validation_result_presentations_cover_supported_values():
|
||||
expected = {
|
||||
"BESTANDEN": ("Bestanden", "result-box--passed"),
|
||||
"BESTANDEN_MIT_AUFLAGEN": ("Bestanden mit Auflagen", "result-box--conditional"),
|
||||
"NICHT_BESTANDEN": ("Nicht bestanden", "result-box--failed"),
|
||||
"OFFEN": ("Noch nicht bewertet", "result-box--open"),
|
||||
}
|
||||
|
||||
for value, (label, css_class) in expected.items():
|
||||
presentation = validation_result_presentation(value)
|
||||
assert presentation.label == label
|
||||
assert presentation.css_class == css_class
|
||||
assert css_class in validation_result_box(value)
|
||||
|
||||
assert validation_result_presentation("mit_auflagen").label == "Bestanden mit Auflagen"
|
||||
|
||||
|
||||
def test_orion_result_boxes_render_on_cover_summary_and_results(tmp_path):
|
||||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
validation = valid_validation(customer, location, device)
|
||||
validation.result = "BESTANDEN_MIT_AUFLAGEN"
|
||||
db.add(validation)
|
||||
db.flush()
|
||||
|
||||
html = OrionReportService(db, tmp_path).render_html(validation.id)
|
||||
|
||||
assert html.count("VALIDIERUNGSERGEBNIS") >= 3
|
||||
assert "BESTANDEN MIT AUFLAGEN" in html
|
||||
assert "Bestanden mit Auflagen" in html
|
||||
assert html.index('id="cover"') < html.index("BESTANDEN MIT AUFLAGEN")
|
||||
assert html.index('id="summary"') < html.index("Bestanden mit Auflagen")
|
||||
assert html.index('id="results"') < html.rindex("Bestanden mit Auflagen")
|
||||
|
||||
|
||||
def test_orion_result_box_css_prevents_page_breaks():
|
||||
css = Path("app/modules/orion/templates/report.css").read_text(encoding="utf-8")
|
||||
|
||||
assert ".result-box" in css
|
||||
assert "break-inside: avoid" in css
|
||||
assert "page-break-inside: avoid" in css
|
||||
assert "#EAF5EE" in css
|
||||
assert "#FFF7DD" in css
|
||||
assert "#FCEBEC" in css
|
||||
|
||||
|
||||
def test_orion_renders_uploaded_images_as_real_images(tmp_path):
|
||||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
|
|
@ -1012,6 +1100,7 @@ def test_orion_pdf_first_page_is_cover_not_blank(tmp_path):
|
|||
db = session()
|
||||
customer, location, device = seed(db)
|
||||
validation = valid_validation(customer, location, device)
|
||||
validation.result = "BESTANDEN"
|
||||
db.add(validation)
|
||||
db.flush()
|
||||
|
||||
|
|
@ -1021,6 +1110,8 @@ def test_orion_pdf_first_page_is_cover_not_blank(tmp_path):
|
|||
|
||||
assert "PRÜFBERICHTZURVALIDIERUNG" in normalized_text
|
||||
assert "FUNKTIONS-UNDLEISTUNGSQUALIFIKATION" in normalized_text
|
||||
assert "VALIDIERUNGSERGEBNIS" in normalized_text
|
||||
assert "BESTANDEN" in normalized_text
|
||||
|
||||
|
||||
def test_orion_bookmark_labels_are_created_from_central_sections(tmp_path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue