async def test_fetch_hook_managed_filter(Hooks, make_hook): "The managed resource dictate which hooks are fetched, including which groups" resources = Resources( [], ["Hook=garbage/.*", "Hook=proj.*", "Hook=imbstack/test4.*"]) hooks = [ # managed: make_hook(hookGroupId="garbage", hookId="test1"), make_hook(hookGroupId="garbage", hookId="test2"), make_hook(hookGroupId="project:gecko", hookId="test3"), # not managed: make_hook(hookGroupId="imbstack", hookId="test5"), # but imbstack is fetched make_hook(hookGroupId="notmanaged", hookId="test5"), ] Hooks.hooks.extend(hooks) await fetch_hooks(resources) assert list(resources) == sorted([Hook.from_api(h) for h in hooks[:3]]) assert Hooks.listHookCalls == ["garbage", "imbstack", "project:gecko"]
async def test_fetch_hook(Hooks, make_hook): resources = Resources([], [".*"]) api_hook = make_hook() Hooks.hooks.append(api_hook) await fetch_hooks(resources) assert list(resources) == [Hook.from_api(api_hook)]