47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
from zotero_kb.api import create_app
|
|
from zotero_kb.config import AppConfig
|
|
|
|
|
|
def _get_index_html(tmp_path) -> str:
|
|
app = create_app(
|
|
AppConfig(
|
|
workspace_dir=tmp_path / "workspace",
|
|
zotero_data_dir=tmp_path / "zotero",
|
|
bridge_file=tmp_path / "bridge.json",
|
|
)
|
|
)
|
|
|
|
for route in app.routes:
|
|
if getattr(route, "path", None) == "/" and "GET" in getattr(route, "methods", set()):
|
|
return route.endpoint()
|
|
|
|
raise AssertionError("GET / route not found")
|
|
|
|
|
|
def test_index_contains_base_page_forms(tmp_path) -> None:
|
|
html = _get_index_html(tmp_path)
|
|
|
|
assert 'id="create-project-form"' in html
|
|
assert 'id="recommend-form"' in html
|
|
assert 'id="plan-form"' in html
|
|
|
|
|
|
def test_index_contains_import_modal_controls(tmp_path) -> None:
|
|
html = _get_index_html(tmp_path)
|
|
|
|
assert 'id="open-import-modal-button"' in html
|
|
assert 'id="import-modal"' in html
|
|
assert 'id="close-import-modal-button"' in html
|
|
assert 'id="modal-collection-tree"' in html
|
|
assert 'id="modal-collection-items"' in html
|
|
assert 'id="modal-selected-count"' in html
|
|
assert 'id="modal-select-descendants-button"' in html
|
|
assert 'id="modal-clear-selection-button"' in html
|
|
assert 'id="modal-import-selected-items-button"' in html
|
|
assert 'id="item-preview-popover"' in html
|
|
assert 'isImportModalOpen: false' in html
|
|
assert "function openImportModal()" in html
|
|
assert "function closeImportModal()" in html
|
|
assert "function updateImportActionState()" in html
|
|
assert 'document.body.classList.toggle("modal-open"' in html
|