feat(qaops): 接入真实通讯录采集并补全根部门
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
### Added
|
||||
|
||||
- 新增治理侧通讯录实时桥接,复用既有周报读取能力,向源端读取真实缺失祖先以补齐部门树;不改旧周报脚本、配置或输出。私有 JSON 与受控子进程执行器拒绝不完整数据、模拟同步、公开文件和异常输出,超时清理临时人员文件;网页触发的后台同步队列及问答组织关联尚未接入。
|
||||
- **「问答运营 → 区域使用」区域归属配置切片**:按稳定部门 ID 搜索和勾选完整路径,预览去重归属人数,保存版本后重新读取;父部门包含子部门、子部门显式配置优先,多部门跨区域人员单独待核对。预览不写入,过期版本和不完整部门树被阻断。当前不是实时通讯录同步或使用/绩效统计验收,翻译及 AI 评估模型接入按用户要求暂缓。
|
||||
- 新增治理侧组织快照与区域修订迁移、受确认保护的后台导入命令;不修改 DobotAI 原表或钉钉组织结构。
|
||||
- **「问答运营 → 问答记录」首个开发切片**:在现有导航中查看 DobotAI 2.0 钉钉问答,支持半开时间范围、原问题关键词、稳定游标分页和完整详情;按整个筛选结果隐藏空列,反馈聚合不放大问答条数。外语翻译、AI 评估、人员区域映射尚未接入,不标为第一阶段完成。
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package qaopsorg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrDirectorySync = errors.New("directory synchronization failed; active snapshot was not replaced")
|
||||
|
||||
type ExecDirectoryRunner struct {
|
||||
Python string
|
||||
Script string
|
||||
RuntimeRoot string
|
||||
SpoolRoot string
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
// Only server-owned paths cross this boundary. Credentials are read by the
|
||||
// existing directory client from its private file, never passed in argv/logs.
|
||||
func (r ExecDirectoryRunner) Run(ctx context.Context) (Import, error) {
|
||||
for _, path := range []string{r.Python, r.Script, r.RuntimeRoot, r.SpoolRoot} {
|
||||
if !filepath.IsAbs(path) || filepath.Clean(path) != path {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
}
|
||||
if r.Timeout == 0 {
|
||||
r.Timeout = 20 * time.Minute
|
||||
}
|
||||
if r.Timeout < time.Millisecond || r.Timeout > 30*time.Minute {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
work, err := os.MkdirTemp(r.SpoolRoot, "qa-directory-")
|
||||
if err != nil {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
defer os.RemoveAll(work)
|
||||
output := filepath.Join(work, "directory.json")
|
||||
runCtx, cancel := context.WithTimeout(ctx, r.Timeout)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(runCtx, r.Python, r.Script, "--runtime-root", r.RuntimeRoot, "--output", output, "--fetch-live-directory")
|
||||
cmd.Dir = r.RuntimeRoot
|
||||
cmd.Env = []string{"PYTHONUNBUFFERED=1"}
|
||||
for _, key := range []string{"PATH", "HOME", "TMPDIR", "LANG", "TZ"} {
|
||||
if value, ok := os.LookupEnv(key); ok {
|
||||
cmd.Env = append(cmd.Env, key+"="+value)
|
||||
}
|
||||
}
|
||||
cmd.Stdout = io.Discard
|
||||
cmd.Stderr = io.Discard
|
||||
cmd.WaitDelay = 3 * time.Second
|
||||
if err = cmd.Run(); err != nil {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
info, err := os.Lstat(output)
|
||||
if err != nil || !info.Mode().IsRegular() || info.Mode().Perm()&0077 != 0 || info.Size() < 1 || info.Size() > 16<<20 {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
file, err := os.Open(output)
|
||||
if err != nil {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
defer file.Close()
|
||||
decoder := json.NewDecoder(io.LimitReader(file, (16<<20)+1))
|
||||
decoder.DisallowUnknownFields()
|
||||
var result Import
|
||||
if decoder.Decode(&result) != nil || decoder.Decode(&struct{}{}) != io.EOF || !result.Complete || result.Source != "weekly_report_live" || result.SyncedAt.IsZero() || result.SyncedAt.After(time.Now().Add(time.Minute)) {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
if _, err = Preview(result.Directory, nil); err != nil {
|
||||
return Import{}, ErrDirectorySync
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package qaopsorg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestDirectoryBridgeRegressionSuiteRunsInDefaultCI(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, "python3", "-m", "unittest", "discover", "-s", "scripts", "-p", "test_qa_ops_directory_sync.py", "-v")
|
||||
cmd.Dir = filepath.Join("..", "..")
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("directory bridge regression failed: %v\n%s", err, output)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDirectoryRunnerParsesPrivateOutputAndRemovesSpool(t *testing.T) {
|
||||
t.Setenv("DINGTALK_CLIENT_SECRET", "fixture-credential-do-not-forward")
|
||||
root := t.TempDir()
|
||||
spool := filepath.Join(root, "spool")
|
||||
if err := os.Mkdir(spool, 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
script := filepath.Join(root, "fake-sync.sh")
|
||||
fixture := `{"source":"weekly_report_live","synced_at":"2026-10-01T00:00:00Z","complete":true,"directory":{"departments":[{"id":"root","parent_id":"","name":"隔离测试部门"}],"people":[{"id":"fixture-user","department_ids":["root"]}]}}`
|
||||
body := "#!/bin/sh\nif [ -n \"${DINGTALK_CLIENT_SECRET:-}\" ]; then exit 3; fi\nwhile [ \"$#\" -gt 0 ]; do if [ \"$1\" = --output ]; then output=$2; shift; fi; shift; done\numask 077\nprintf '%s' '" + fixture + "' > \"$output\"\n"
|
||||
if err := os.WriteFile(script, []byte(body), 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
runner := ExecDirectoryRunner{Python: "/bin/sh", Script: script, RuntimeRoot: root, SpoolRoot: spool, Timeout: time.Second}
|
||||
result, err := runner.Run(context.Background())
|
||||
if err != nil || len(result.Directory.People) != 1 {
|
||||
t.Fatalf("runner failed: %v", err)
|
||||
}
|
||||
entries, err := os.ReadDir(spool)
|
||||
if err != nil || len(entries) != 0 {
|
||||
t.Fatal("personnel spool leaked")
|
||||
}
|
||||
if err := os.WriteFile(script, []byte("#!/bin/sh\nprintf 'secret-driver-detail' >&2\nexit 1\n"), 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = runner.Run(context.Background())
|
||||
if err == nil || strings.Contains(err.Error(), "secret-driver-detail") {
|
||||
t.Fatal("runner error is missing or leaks child stderr")
|
||||
}
|
||||
entries, _ = os.ReadDir(spool)
|
||||
if len(entries) != 0 {
|
||||
t.Fatal("failed runner leaked spool")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDirectoryRunnerRejectsMalformedOrPublicPersonnelOutput(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
for _, mode := range []string{"malformed", "public"} {
|
||||
script := filepath.Join(root, mode+".sh")
|
||||
body := "#!/bin/sh\numask 077\nwhile [ \"$#\" -gt 0 ]; do if [ \"$1\" = --output ]; then output=$2; shift; fi; shift; done\nprintf '%s' '{not-json}' > \"$output\"\n"
|
||||
if mode == "public" {
|
||||
body += "printf '%s' '{\"source\":\"weekly_report_live\",\"synced_at\":\"2026-10-01T00:00:00Z\",\"complete\":true,\"directory\":{\"departments\":[{\"id\":\"root\",\"parent_id\":\"\",\"name\":\"fixture\"}],\"people\":[{\"id\":\"fixture-user\",\"department_ids\":[\"root\"]}]}}' > \"$output\"\nchmod 644 \"$output\"\n"
|
||||
}
|
||||
if err := os.WriteFile(script, []byte(body), 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
runner := ExecDirectoryRunner{Python: "/bin/sh", Script: script, RuntimeRoot: root, SpoolRoot: root, Timeout: time.Second}
|
||||
if _, err := runner.Run(context.Background()); err == nil {
|
||||
t.Fatal("invalid output accepted")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDirectoryRunnerDeadlineStopsChildAndCleansPrivateSpool(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
spool := filepath.Join(root, "spool")
|
||||
if err := os.Mkdir(spool, 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
script := filepath.Join(root, "timeout.sh")
|
||||
if err := os.WriteFile(script, []byte("#!/bin/sh\nexec sleep 30\n"), 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
runner := ExecDirectoryRunner{Python: "/bin/sh", Script: script, RuntimeRoot: root, SpoolRoot: spool, Timeout: 50 * time.Millisecond}
|
||||
started := time.Now()
|
||||
if _, err := runner.Run(context.Background()); err == nil {
|
||||
t.Fatal("timed-out source reported success")
|
||||
}
|
||||
if time.Since(started) > 5*time.Second {
|
||||
t.Fatal("source process cleanup is unbounded")
|
||||
}
|
||||
entries, err := os.ReadDir(spool)
|
||||
if err != nil || len(entries) != 0 {
|
||||
t.Fatal("timed-out source retained personnel spool")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
"""Read-only bridge to the existing weekly-report contacts fetchers.
|
||||
|
||||
The bridge does not execute the weekly report, export spreadsheets, write its
|
||||
configuration, or infer company/department names. All new data stays in a private
|
||||
caller-selected JSON file for the governance importer.
|
||||
"""
|
||||
import argparse
|
||||
from datetime import datetime, timezone
|
||||
import importlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import types
|
||||
from urllib.request import HTTPRedirectHandler, ProxyHandler, build_opener
|
||||
|
||||
sys.dont_write_bytecode = True
|
||||
|
||||
|
||||
class DirectorySyncError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
def _validate_directory(departments, people):
|
||||
if not departments or not people or len(departments) > 20000 or len(people) > 100000:
|
||||
raise DirectorySyncError('directory_integrity_failed')
|
||||
for identity, department in departments.items():
|
||||
if identity <= 0 or not department.get('name'):
|
||||
raise DirectorySyncError('directory_integrity_failed')
|
||||
seen = set()
|
||||
current = identity
|
||||
while current:
|
||||
if current in seen or current not in departments or len(seen) > 100:
|
||||
raise DirectorySyncError('directory_integrity_failed')
|
||||
seen.add(current)
|
||||
current = int(departments[current].get('parent_id') or 0)
|
||||
for identity, person in people.items():
|
||||
if not identity or str(person.get('user_id') or '') != str(identity):
|
||||
raise DirectorySyncError('directory_integrity_failed')
|
||||
if not person.get('department_ids') or any(int(d) not in departments for d in person['department_ids']):
|
||||
raise DirectorySyncError('directory_integrity_failed')
|
||||
|
||||
|
||||
def collect_directory(client, fetch_departments, fetch_users, get_detail, logger):
|
||||
if client.config.dry_run:
|
||||
raise DirectorySyncError('directory_dry_run_rejected')
|
||||
departments, denied, failed = fetch_departments(client, logger, None, None)
|
||||
if denied or failed or not departments:
|
||||
raise DirectorySyncError('directory_department_fetch_incomplete')
|
||||
departments = dict(departments)
|
||||
# Legacy full traversal returns children but omits the starting root. Read
|
||||
# actual missing ancestors; never manufacture a root or discard parent IDs.
|
||||
for _ in range(100):
|
||||
missing = sorted({int(d.get('parent_id') or 0) for d in departments.values()} - set(departments) - {0})
|
||||
if not missing:
|
||||
break
|
||||
for identity in missing:
|
||||
detail, denied, failed = get_detail(client, logger, identity)
|
||||
if denied or failed or not detail or int(detail.get('id') or 0) != identity or not detail.get('name'):
|
||||
raise DirectorySyncError('directory_ancestor_unavailable')
|
||||
departments[identity] = detail
|
||||
else:
|
||||
raise DirectorySyncError('directory_integrity_failed')
|
||||
people, denied, failed = fetch_users(client, logger, sorted(departments), enable_user_detail=False)
|
||||
if denied or failed:
|
||||
raise DirectorySyncError('directory_people_fetch_incomplete')
|
||||
_validate_directory(departments, people)
|
||||
return {
|
||||
'source': 'weekly_report_live',
|
||||
'synced_at': datetime.now(timezone.utc).isoformat(),
|
||||
'complete': True,
|
||||
'directory': {
|
||||
'departments': [
|
||||
{'id': str(identity), 'parent_id': str(int(d.get('parent_id') or 0)) if d.get('parent_id') else '', 'name': str(d['name'])}
|
||||
for identity, d in sorted(departments.items())
|
||||
],
|
||||
# List membership provides stable staff IDs; do not reuse the old
|
||||
# guessed primary department, employment policy or openId fallback.
|
||||
'people': [
|
||||
{'id': str(identity), 'union_id': str((p.get('raw_payload') or {}).get('unionid') or (p.get('raw_payload') or {}).get('unionId') or ''), 'department_ids': [str(d) for d in sorted(p['department_ids'])]}
|
||||
for identity, p in sorted(people.items())
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class _NoRedirect(HTTPRedirectHandler):
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
raise DirectorySyncError('directory_redirect_rejected')
|
||||
|
||||
|
||||
def load_existing_runtime(root):
|
||||
root = Path(root)
|
||||
if not root.is_absolute() or not (root / 'scripts/dingtalk_sync/client.py').is_file():
|
||||
raise DirectorySyncError('directory_configuration_invalid')
|
||||
secret = root / '.env'
|
||||
info = secret.lstat()
|
||||
if not secret.is_file() or secret.is_symlink() or info.st_mode & 0o077:
|
||||
raise DirectorySyncError('directory_configuration_invalid')
|
||||
package_name = '_qaops_weekly_directory'
|
||||
package = types.ModuleType(package_name)
|
||||
package.__path__ = [str(root / 'scripts/dingtalk_sync')]
|
||||
sys.modules[package_name] = package
|
||||
client_module = importlib.import_module(package_name + '.client')
|
||||
dept_module = importlib.import_module(package_name + '.fetch_departments')
|
||||
people_module = importlib.import_module(package_name + '.fetch_users')
|
||||
config = client_module.load_sync_config(str(secret), str(root / 'config/dingtalk_sync.yaml'))
|
||||
if config.api_base_url.rstrip('/') != 'https://oapi.dingtalk.com' or config.dry_run or config.api_mode != 'topapi_v2':
|
||||
raise DirectorySyncError('directory_configuration_invalid')
|
||||
if not (1 <= config.timeout_seconds <= 30 and 0 <= config.max_retries <= 3 and 1 <= config.page_size <= 100):
|
||||
raise DirectorySyncError('directory_configuration_invalid')
|
||||
# Keep the old transport inside this private module namespace. Suppress its
|
||||
# potentially sensitive exception logging and refuse redirects/proxies.
|
||||
logger = logging.getLogger('qa_ops_directory_private')
|
||||
logger.handlers = [logging.NullHandler()]
|
||||
logger.propagate = False
|
||||
opener = build_opener(ProxyHandler({}), _NoRedirect())
|
||||
setattr(client_module, 'urlopen', opener.open)
|
||||
|
||||
class BoundedClient(client_module.DingtalkClient):
|
||||
def __init__(self):
|
||||
super().__init__(config, logger=logger)
|
||||
self.requests = 0
|
||||
self.pages = set()
|
||||
|
||||
def request_json(self, method, path, params=None, json_body=None, retry_on_business_error=True):
|
||||
self.requests += 1
|
||||
if self.requests > 10000:
|
||||
raise DirectorySyncError('directory_request_limit')
|
||||
if path.endswith('/listsub') or path.endswith('/user/list'):
|
||||
key = (path, json.dumps(json_body, sort_keys=True))
|
||||
if key in self.pages:
|
||||
raise DirectorySyncError('directory_pagination_repeated')
|
||||
self.pages.add(key)
|
||||
return super().request_json(method, path, params, json_body, retry_on_business_error)
|
||||
|
||||
return BoundedClient(), dept_module.fetch_all_departments, people_module.fetch_users, dept_module._get_department_detail, logger
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Fetch a complete read-only directory into private governance JSON; no weekly-report writes')
|
||||
parser.add_argument('--runtime-root', required=True)
|
||||
parser.add_argument('--output', required=True)
|
||||
parser.add_argument('--fetch-live-directory', action='store_true', required=True)
|
||||
args = parser.parse_args()
|
||||
output = Path(args.output)
|
||||
if not output.is_absolute() or output.exists():
|
||||
raise DirectorySyncError('directory_output_must_be_new_absolute_path')
|
||||
client, departments, people, detail, logger = load_existing_runtime(args.runtime_root)
|
||||
print(json.dumps({'stage': 'fetching_live_directory', 'weekly_report_outputs_modified': False}), flush=True)
|
||||
result = collect_directory(client, departments, people, detail, logger)
|
||||
raw = json.dumps(result, ensure_ascii=False).encode('utf-8')
|
||||
if len(raw) > 16 << 20:
|
||||
raise DirectorySyncError('directory_output_limit')
|
||||
fd = os.open(output, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
try:
|
||||
with os.fdopen(fd, 'wb') as stream:
|
||||
stream.write(raw)
|
||||
stream.flush()
|
||||
os.fsync(stream.fileno())
|
||||
except BaseException:
|
||||
output.unlink(missing_ok=True)
|
||||
raise
|
||||
print(json.dumps({'stage': 'complete', 'departments': len(result['directory']['departments']), 'people': len(result['directory']['people']), 'synced_at': result['synced_at'], 'requests': client.requests, 'complete': True, 'employee_identities_logged': False, 'weekly_report_outputs_modified': False}), flush=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except Exception as failure:
|
||||
code = str(failure) if isinstance(failure, DirectorySyncError) else 'directory_sync_failed'
|
||||
print(json.dumps({'stage': 'failed', 'code': code}), file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
@@ -0,0 +1,58 @@
|
||||
import importlib.util
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
spec=importlib.util.spec_from_file_location('qa_ops_directory_sync',Path(__file__).with_name('qa_ops_directory_sync.py'))
|
||||
assert spec is not None and spec.loader is not None
|
||||
sync=importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(sync)
|
||||
|
||||
class FakeClient:
|
||||
class Config:
|
||||
dry_run=False
|
||||
def __init__(self):
|
||||
self.config=self.Config()
|
||||
|
||||
def full_departments(client,logger,include,exclude):
|
||||
return {10:{'id':10,'parent_id':1,'name':'示例业务'}},set(),set()
|
||||
def full_users(client,logger,ids,enable_user_detail):
|
||||
if enable_user_detail:
|
||||
raise AssertionError('Must not inherit silent per-user detail failures or guessed primary department')
|
||||
return {'fixture-user':{'user_id':'fixture-user','department_ids':{10},'raw_payload':{'unionid':'fixture-union'}}},set(),set()
|
||||
def root_detail(client,logger,department_id):
|
||||
return {'id':department_id,'parent_id':0,'name':'真实源端返回的示例根部门'},False,False
|
||||
|
||||
class DirectoryBridgeTests(unittest.TestCase):
|
||||
def test_fetches_the_real_missing_root_and_preserves_stable_identities(self):
|
||||
result=sync.collect_directory(FakeClient(),full_departments,full_users,root_detail,logging.getLogger('fixture'))
|
||||
self.assertTrue(result['complete'])
|
||||
self.assertEqual(result['source'],'weekly_report_live')
|
||||
self.assertEqual(result['directory']['departments'],[
|
||||
{'id':'1','parent_id':'','name':'真实源端返回的示例根部门'},
|
||||
{'id':'10','parent_id':'1','name':'示例业务'}])
|
||||
self.assertEqual(result['directory']['people'],[{'id':'fixture-user','union_id':'fixture-union','department_ids':['10']}])
|
||||
def test_inaccessible_root_is_not_replaced_with_a_fabricated_company(self):
|
||||
def denied(*args):return None,True,False
|
||||
with self.assertRaisesRegex(sync.DirectorySyncError,'directory_ancestor_unavailable'):
|
||||
sync.collect_directory(FakeClient(),full_departments,full_users,denied,logging.getLogger('fixture'))
|
||||
def test_partial_fetch_and_dry_run_do_not_become_complete_live_snapshots(self):
|
||||
def partial(*args):return {},set(),{10}
|
||||
with self.assertRaises(sync.DirectorySyncError):
|
||||
sync.collect_directory(FakeClient(),partial,full_users,root_detail,logging.getLogger('fixture'))
|
||||
client=FakeClient();client.config.dry_run=True
|
||||
with self.assertRaises(sync.DirectorySyncError):
|
||||
sync.collect_directory(client,full_departments,full_users,root_detail,logging.getLogger('fixture'))
|
||||
def test_union_id_does_not_fall_back_to_open_id(self):
|
||||
def users(*args,**kwargs):return {'u':{'user_id':'u','department_ids':{10},'union_id':'not-a-union','raw_payload':{'openId':'not-a-union'}}},set(),set()
|
||||
result=sync.collect_directory(FakeClient(),full_departments,users,root_detail,logging.getLogger('fixture'))
|
||||
self.assertEqual(result['directory']['people'][0]['union_id'],'')
|
||||
def test_wrong_root_identity_and_cycles_are_rejected(self):
|
||||
def wrong(*args):return {'id':999,'parent_id':0,'name':'wrong'},False,False
|
||||
with self.assertRaises(sync.DirectorySyncError):
|
||||
sync.collect_directory(FakeClient(),full_departments,full_users,wrong,logging.getLogger('fixture'))
|
||||
def cyclic(*args):return {1:{'id':1,'parent_id':10,'name':'a'},10:{'id':10,'parent_id':1,'name':'b'}},set(),set()
|
||||
with self.assertRaises(sync.DirectorySyncError):
|
||||
sync.collect_directory(FakeClient(),cyclic,full_users,root_detail,logging.getLogger('fixture'))
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
Reference in New Issue
Block a user