release: prepare Hulumath v1.2.0
This commit is contained in:
@@ -180,3 +180,13 @@ def test_math_life_使用独立界面印记面板且清理交叉点():
|
||||
assert "function renderStoryMarks(run)" in app
|
||||
assert "choice.special" in app
|
||||
assert ".story-experience { position: fixed; inset: 0" in styles
|
||||
|
||||
|
||||
def test_home_公众号入口可复制并跳转微信():
|
||||
template = (settings.BASE_DIR / "templates" / "index.html").read_text(encoding="utf-8")
|
||||
app = (STATIC_ROOT / "js" / "app.js").read_text(encoding="utf-8")
|
||||
|
||||
assert 'id="wechat-copy"' in template
|
||||
assert 'href="weixin://"' in template
|
||||
assert "function copyWechatName()" in app
|
||||
assert 'navigator.clipboard.writeText(name)' in app
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_health_包含当前发布版本(client):
|
||||
response = client.get("/health/")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {
|
||||
"status": "ok",
|
||||
"database": "ok",
|
||||
"version": settings.APP_VERSION,
|
||||
}
|
||||
|
||||
|
||||
def test_home_展示公众号入口与版本(client):
|
||||
response = client.get("/")
|
||||
content = response.content.decode()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "公众号" in content
|
||||
assert "葫芦数学" in content
|
||||
assert f"Hulumath v{settings.APP_VERSION}" in content
|
||||
assert 'href="weixin://"' in content
|
||||
@@ -1,14 +1,21 @@
|
||||
from django.conf import settings
|
||||
from django.db import connection
|
||||
from django.http import JsonResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
|
||||
def home(request):
|
||||
return render(request, "index.html")
|
||||
return render(request, "index.html", {"app_version": settings.APP_VERSION})
|
||||
|
||||
|
||||
def health(request):
|
||||
with connection.cursor() as cursor:
|
||||
cursor.execute("SELECT 1")
|
||||
cursor.fetchone()
|
||||
return JsonResponse({"status": "ok", "database": "ok"})
|
||||
return JsonResponse(
|
||||
{
|
||||
"status": "ok",
|
||||
"database": "ok",
|
||||
"version": settings.APP_VERSION,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user