"""按有效角色查用户:空入参行为(不依赖 DB)。""" from app.services.web_auth_roles import ( list_user_ids_with_any_effective_role_ids, list_user_ids_with_effective_role_name, ) class _DummySession: def query(self, *args, **kwargs): # pragma: no cover raise AssertionError("空入参不应访问数据库") def test_list_by_role_name_empty_inputs(): db = _DummySession() assert list_user_ids_with_effective_role_name(db, tenant_no="", role_name="实验专员") == set() assert list_user_ids_with_effective_role_name(db, tenant_no="zkxw", role_name="") == set() assert list_user_ids_with_effective_role_name( db, tenant_no="zkxw", role_name="实验专员", candidate_user_ids=[] ) == set() def test_list_by_role_ids_empty_inputs(): db = _DummySession() assert list_user_ids_with_any_effective_role_ids(db, tenant_no="zkxw", role_ids=[]) == [] assert list_user_ids_with_any_effective_role_ids(db, tenant_no="", role_ids=["r1"]) == [] assert ( list_user_ids_with_any_effective_role_ids( db, tenant_no="zkxw", role_ids=["r1"], candidate_user_ids=[] ) == [] )