36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
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
|