@login_required()
def report(request, report_id):
employee_id = request.user.employee.user_id
if not Report.objects.filter(report_id=report_id).filter(employee_id=employee_id).select_related().exists():
return HttpResponseForbidden()
rep = get_object_or_404(Report, pk=report_id)
return MyJsonResponse(rep.serialize())
Im trying to test this. So i've written this test
def test_report(self):
report_id = 99
request = self.factory.get('/reports/{}'.format(report_id))
request.user = AnonymousUser()
response = report(request,report_id)
self.assertEqual(response.status_code,403)
The problem is that i cant debug my view. I placed a breakpoint on
response = report(request,report_id)
but i cant step into it in order to see what's happening inside of
def report(request, report_id):
When i try to step into(F7) it opens decorators.py
Aucun commentaire:
Enregistrer un commentaire