Hi I'm new to Django and I'm trying to write some unit test cases for given function. Can anyone give me a sample unit test cases for this function? THANKS!!
This is the function in views.py:
def signin(request):
error = ""
if request.method == 'POST':
user = authenticate(username=request.POST.get("username",""), password=request.POST.get("password",""))
if user is not None:
if user.is_active:
login(request, user)
return HttpResponseRedirect("/bet/")
error="Unable to login."
form = SigninForm(auto_id=False)
return render(request, 'frontend/signin.html', context_instance=RequestContext(request, {'form': form, 'error': error}))
Aucun commentaire:
Enregistrer un commentaire