feat: add admin dashboard, pipeline service, lightbox, and update dependencies
This commit is contained in:
+6
-17
@@ -3,14 +3,12 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from datetime import date, datetime, timezone
|
||||
from pathlib import Path
|
||||
from unittest.mock import AsyncMock
|
||||
from datetime import date
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import create_engine, event
|
||||
from sqlalchemy.orm import DeclarativeBase, sessionmaker
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.pool import StaticPool
|
||||
|
||||
from app.database import get_db
|
||||
@@ -23,21 +21,12 @@ from app.models import (
|
||||
PaperTag,
|
||||
SummaryStatus,
|
||||
)
|
||||
from app.utils import utc_now
|
||||
|
||||
|
||||
# ── 内存数据库 ──────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
class _TestBase(DeclarativeBase):
|
||||
pass
|
||||
|
||||
|
||||
# 复用 app.models 的 Base metadata
|
||||
from app.database import Base as _AppBase # noqa: E402
|
||||
|
||||
_TestBase.metadata = _AppBase.metadata
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def db_engine():
|
||||
"""创建内存 SQLite 引擎 + FTS5。"""
|
||||
@@ -94,7 +83,7 @@ _TEST_ADMIN_PASSWORD = "test-password-12345"
|
||||
@pytest.fixture
|
||||
def sample_paper(db_session):
|
||||
"""插入一篇测试论文 + 作者 + 标签 + summary_status(pending)。"""
|
||||
now = datetime.now(timezone.utc)
|
||||
now = utc_now()
|
||||
paper = Paper(
|
||||
arxiv_id=SAMPLE_ARXIV_ID,
|
||||
title_en="Test Paper Title",
|
||||
@@ -234,7 +223,7 @@ def auth_client(client, monkeypatch):
|
||||
@pytest.fixture
|
||||
def sample_papers_range(db_session):
|
||||
"""插入 5 篇不同日期的论文(用于 admin / cleaner 测试)。"""
|
||||
now = datetime.now(timezone.utc)
|
||||
now = utc_now()
|
||||
papers = []
|
||||
for i, (arxiv_id, paper_date_str) in enumerate(
|
||||
[
|
||||
@@ -281,7 +270,7 @@ def sample_papers_range(db_session):
|
||||
@pytest.fixture
|
||||
def sample_papers_with_summary(db_session):
|
||||
"""插入 5 篇带总结的论文(用于 search / pages / trends 测试)。"""
|
||||
now = datetime.now(timezone.utc)
|
||||
now = utc_now()
|
||||
papers = []
|
||||
for i, (arxiv_id, paper_date_str) in enumerate(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user