Пример #1
0
 def test_password_confirmation_is_valid(self):
     data = {
         'email': '*****@*****.**',
         'password': '******',
         'same_password_again': 'abc123'
     }
     form = forms.SignupForm(data)
     self.assertTrue(form.is_valid())
Пример #2
0
 def post(self, request):
     form = forms.SignupForm(request.POST)
     if form.is_valid():
         user = form.save()
         login(request, user)
         return redirect('/')
         context = {"forms": form}
         return render(request, 'auth/signup.html', context)
Пример #3
0
 def test_password_confirmation_is_invalid(self):
     data = {
         'email': '*****@*****.**',
         'password': '******',
         'same_password_again': 'not the same'
     }
     form = forms.SignupForm(data)
     self.assertFalse(form.is_valid())
     self.assertIn(u'You must type the same password twice!',
                   form.errors['same_password_again'])
Пример #4
0
 def get(self, request):
     context = {"form": forms.SignupForm()}
     return render(request, 'auth/signup.html', context)