fix: 检查凭据时同步姓名和公司

This commit is contained in:
Nixevol
2026-11-18 11:58:11 +08:00
parent 199960276a
commit 66b4d74ba8
4 changed files with 41 additions and 3 deletions
+9 -2
View File
@@ -362,6 +362,9 @@ class _Alive:
def credential_alive(self) -> bool:
return True
def checked_profile(self) -> dict:
return {"name": "莫英达", "department": "广州瀚信广州处", "level": "Scientist"}
def month_hours(self) -> str:
return "660"
@@ -526,8 +529,8 @@ def test_check_skips_empty_credential_and_updates_saved_one(monkeypatch) -> None
assert saved["refresh_paused"] is False
assert saved["credential_valid"] is True
assert saved["month_hours"] == ""
assert saved["user_name"] == ""
assert saved["company"] == ""
assert saved["user_name"] == "莫英达"
assert saved["company"] == "广州瀚信广州处"
assert isinstance(saved["last_refresh_at"], str)
calls.clear()
again = client.get("/api/admin/users")
@@ -563,9 +566,13 @@ def test_check_all_reports_each_saved_account(monkeypatch) -> None:
with SessionLocal() as db:
failed = db.get(Account, "b-user")
untouched = db.get(Account, "c-user")
checked = db.get(Account, "a-user")
assert checked is not None and checked.user_name == "莫英达" and checked.company == "广州瀚信广州处"
assert failed is not None and failed.credential_valid is None
assert failed.user_name == "" and failed.company == ""
assert failed.last_refresh_at is not None
assert untouched is not None and untouched.last_refresh_at is None
assert untouched.user_name == "" and untouched.company == ""
def test_credentials_and_delete_user(monkeypatch) -> None: