"""Ekran ustawień: bazy na udziale (PRE-09).""" import pathlib from tests.skladanie import zloz_kod APP = pathlib.Path(__file__).resolve().parents[1] / "app" TPL = (APP / "templates" / "settings.html").read_text(encoding="utf-8") BASE = (APP / "templates" / "base.html").read_text(encoding="utf-8") # Trasy mieszkają w app/ekrany/* — patrz tests/skladanie.py. MAIN = zloz_kod() CLIENT = (APP / "clients" / "logic_client.py").read_text(encoding="utf-8") def test_tab_is_in_the_menu(): """Zakładka jest w KATALOGU FUNKCJI — stamtąd buduje się nawigacja. Menu nie jest już listą wpisaną w base.html: powstaje z uprawnień konta (PRE-26), więc szukanie w szablonie sztywnego linku nic by nie mówiło. Że nawigacja faktycznie renderuje katalog, sprawdza test_kontrola_dostepu.""" from app import features tab = features.BY_KEY["settings"] assert tab in features.SCREENS assert tab.href and tab.label def test_route_and_client_exist(): assert '@app.get("/settings"' in MAIN and "logic.bases()" in MAIN assert 'f"{self.base_url}/bases"' in CLIENT def test_listing_shows_name_and_metadata(): for col in ("b.name", "b.path", "b.size_mb", "b.modified"): assert col in TPL, f"brak kolumny {col}" def test_listing_shows_whether_base_counts_in_interpretation(): assert "b.enabled" in TPL and "wyłączona" in TPL def test_page_explains_how_to_disable_and_why_not_clickable(): """Ekran ma mówić, JAK wyłączyć bazę — inaczej podgląd bez sprawczości myli.""" assert "DISABLED_BASES" in TPL assert "emptyDir" in TPL # uzasadnienie: brak trwałego zapisu def test_error_from_logic_does_not_break_the_page(): assert "_logic_error(e)" in MAIN[MAIN.index("def settings_view"):MAIN.index("def settings_view") + 900]