feat(admin): finalizing modular refactoring with testing suite and UI polish
This commit is contained in:
35
backend/tests/test_admin.py
Normal file
35
backend/tests/test_admin.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import pytest
|
||||
|
||||
def test_get_backups(client):
|
||||
response = client.get("/admin/db/backups")
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
|
||||
def test_db_settings_workflow(client):
|
||||
# GET settings
|
||||
response = client.get("/admin/db/settings")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "retention_count" in data
|
||||
|
||||
# PATCH settings
|
||||
new_settings = {
|
||||
"retention_count": 25,
|
||||
"schedule_hour": 5,
|
||||
"schedule_freq_days": 2
|
||||
}
|
||||
response = client.patch("/admin/db/settings", json=new_settings)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["retention_count"] == 25
|
||||
|
||||
# Verify persistence
|
||||
response = client.get("/admin/db/settings")
|
||||
assert response.json()["retention_count"] == 25
|
||||
|
||||
def test_ai_config(client):
|
||||
response = client.get("/admin/db/settings/ai")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "active_provider" in data
|
||||
assert "providers" in data
|
||||
assert len(data["providers"]) == 2
|
||||
Reference in New Issue
Block a user