I'm new to Unit Testing. I have a view which takes an AJAX request and creates a new Organization to my database. How do I test it?
Here is my view:
@csrf_exempt
def newOrg(request):
if request.method == 'POST':
param = json.loads(request.body)
org = param.get('org')
Organization.objects.create(orgname=org)
return JsonResponse({'status':200})
The url used:
('ajax/newOrg/', views_admin.newOrg, name='ajax_newOrg'),
Aucun commentaire:
Enregistrer un commentaire