26 lines
666 B
Python
26 lines
666 B
Python
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
|