Fix hook test method
This commit is contained in:
parent
15e00112af
commit
3b8e5dbdd1
|
@ -125,11 +125,17 @@ class HookAPI(APIView):
|
||||||
|
|
||||||
def get(self, request, hook_name):
|
def get(self, request, hook_name):
|
||||||
try:
|
try:
|
||||||
hook = Hook.objects.get(name=hook_name)
|
hook = Hook.objects.get(hook=hook_name)
|
||||||
except Hook.DoesNotExist:
|
except Hook.DoesNotExist:
|
||||||
return HttpResponseBadRequest("Hook does not exist.")
|
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")
|
return HttpResponse(orjson.dumps(return_data), content_type="application/json")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue