Fix hook test method

This commit is contained in:
Mark Veidemanis 2022-12-06 20:12:24 +00:00
parent 15e00112af
commit 3b8e5dbdd1
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 8 additions and 2 deletions

View File

@ -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")