mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-08 00:18:12 +08:00
Refactor: reformat all code for lefthook using ruff and gofmt (#16585)
This commit is contained in:
@@ -183,10 +183,7 @@ def test_load_user_api_token_fallback_and_fallback_exception(monkeypatch, caplog
|
||||
return []
|
||||
|
||||
def _query_user(**kwargs):
|
||||
if (
|
||||
kwargs.get("id") == "tenant-1"
|
||||
and kwargs.get("status") == apps_module.StatusEnum.VALID.value
|
||||
):
|
||||
if kwargs.get("id") == "tenant-1" and kwargs.get("status") == apps_module.StatusEnum.VALID.value:
|
||||
return [beta_user]
|
||||
return []
|
||||
|
||||
|
||||
@@ -122,9 +122,7 @@ def _load_system_module(monkeypatch):
|
||||
monkeypatch.setitem(sys.modules, "api.db.services.knowledgebase_service", kb_service_mod)
|
||||
|
||||
user_service_mod = ModuleType("api.db.services.user_service")
|
||||
user_service_mod.UserTenantService = SimpleNamespace(
|
||||
query=lambda **_kwargs: [SimpleNamespace(role="owner", tenant_id="tenant-1")]
|
||||
)
|
||||
user_service_mod.UserTenantService = SimpleNamespace(query=lambda **_kwargs: [SimpleNamespace(role="owner", tenant_id="tenant-1")])
|
||||
monkeypatch.setitem(sys.modules, "api.db.services.user_service", user_service_mod)
|
||||
|
||||
db_models_mod = ModuleType("api.db.db_models")
|
||||
@@ -214,6 +212,7 @@ def test_status_branch_matrix_unit(monkeypatch):
|
||||
assert "Lost connection!" in res["data"]["redis"]["error"]
|
||||
assert res["data"]["task_executor_heartbeats"] == {}
|
||||
|
||||
|
||||
@pytest.mark.p2
|
||||
def test_get_config_returns_register_enabled_unit(monkeypatch):
|
||||
module = _load_system_module(monkeypatch)
|
||||
|
||||
Reference in New Issue
Block a user