41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""系统配置扩展测试。
|
|
|
|
测试用例:
|
|
- CFG-007: 配置即时生效
|
|
- CFG-008/009: 配置接口安全
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.config
|
|
@pytest.mark.p1
|
|
class TestConfigExtended:
|
|
"""系统配置扩展测试。"""
|
|
|
|
def test_query_config(self, client, admin_headers):
|
|
"""查询配置项。"""
|
|
resp = client.get("/api/configs/logistics_timeout_days", headers=admin_headers)
|
|
assert resp.status_code == 200
|
|
|
|
def test_update_config(self, client, admin_headers):
|
|
"""更新配置项。"""
|
|
resp = client.put("/api/configs/logistics_timeout_days", headers=admin_headers, json={
|
|
"config_value": "3",
|
|
})
|
|
assert resp.status_code == 200
|
|
|
|
def test_query_nonexistent_config(self, client, admin_headers):
|
|
"""查询不存在的配置项。"""
|
|
resp = client.get("/api/configs/nonexistent_key_xyz", headers=admin_headers)
|
|
assert resp.status_code in (200, 404)
|
|
|
|
def test_update_and_query(self, client, admin_headers):
|
|
"""CFG-007: 更新后立即查询应返回新值。"""
|
|
client.put("/api/configs/inactive_customer_days", headers=admin_headers, json={
|
|
"config_value": "60",
|
|
})
|
|
resp = client.get("/api/configs/inactive_customer_days", headers=admin_headers)
|
|
assert resp.status_code == 200
|