fix: 自有账号模式下仍可向账号池添加平台账号
This commit is contained in:
@@ -110,6 +110,21 @@ def test_local_login_task_and_admin(client: TestClient):
|
||||
assert "小区" in downloaded.content.decode("utf-8-sig")
|
||||
|
||||
|
||||
def test_pool_add_is_allowed_when_login_is_local(client: TestClient, monkeypatch):
|
||||
from app.nqi.client import NqiError
|
||||
|
||||
async def fail_open(self):
|
||||
raise NqiError("未连接平台")
|
||||
|
||||
monkeypatch.setattr("app.api.http.NqiClient.open_login", fail_open)
|
||||
blocked = client.post("/api/auth/nqi/start", json={"username": "someone"})
|
||||
assert blocked.status_code == 400
|
||||
assert blocked.json()["detail"] == "当前使用自有账号登录"
|
||||
pool = client.post("/api/auth/nqi/start", json={"username": "someone", "purpose": "pool"})
|
||||
assert pool.status_code == 400
|
||||
assert pool.json()["detail"] == "未连接平台"
|
||||
|
||||
|
||||
def test_concurrency_bounds():
|
||||
assert check_concurrency(1) == 1
|
||||
assert check_concurrency(32) == 32
|
||||
|
||||
Reference in New Issue
Block a user