feat: add common utilities and feedback handling scripts
- Introduced common.js for shared functions including API calls, error reporting, and UI helpers. - Implemented feedback.js for the feedback reporting page, including form handling and displaying feedback status. - Added layout.js for managing galaxy and section layouts in the visualization. - Created login.js for user authentication with session management. - Developed search.js for term searching based on user input and synonyms. - Implemented signup.js for user registration with validation and immediate login.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(ROOT))
|
||||
os.environ["ATLAS_OWNER_PASSWORD"] = "owner-pass"
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def client(tmp_path, monkeypatch):
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from server import db
|
||||
monkeypatch.setattr(db, "DB_PATH", tmp_path / "test.db")
|
||||
db._local.__dict__.clear()
|
||||
from server import app as app_module
|
||||
app_module._hits.clear()
|
||||
with TestClient(app_module.app) as c:
|
||||
yield c
|
||||
db._local.__dict__.clear()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def admin(client):
|
||||
r = client.post("/api/admin/login", json={"username": "professor", "password": "owner-pass"})
|
||||
assert r.status_code == 200
|
||||
return client
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def atlas():
|
||||
return json.loads((ROOT / "data" / "atlas.json").read_text())
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def owner(client):
|
||||
r = client.post("/api/admin/login", json={"username": "professor", "password": "owner-pass"})
|
||||
assert r.status_code == 200 and r.json()["role"] == "owner"
|
||||
return client
|
||||
Reference in New Issue
Block a user