From 3b8e5dbdd17a794d8e90aa5e127f449e4007d6ce Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 6 Dec 2022 20:12:24 +0000 Subject: [PATCH] Fix hook test method --- core/views/hooks.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/views/hooks.py b/core/views/hooks.py index 896e79e..379f40a 100644 --- a/core/views/hooks.py +++ b/core/views/hooks.py @@ -125,11 +125,17 @@ class HookAPI(APIView): def get(self, request, hook_name): try: - hook = Hook.objects.get(name=hook_name) + hook = Hook.objects.get(hook=hook_name) except Hook.DoesNotExist: return HttpResponseBadRequest("Hook does not exist.") + signals = Signal.objects.filter(hook=hook) - return_data = {"name": hook.name, "hook": hook.hook, "hook_id": hook.id} + return_data = { + "name": hook.name, + "hook": hook.hook, + "hook_id": hook.id, + "signals": len(signals), + } return HttpResponse(orjson.dumps(return_data), content_type="application/json")