Beispiel #1
0
 def test_with_correct_data(self):
     form = SignUpForm(data=self.registr_data)
     self.assertTrue(form.is_valid())
     form.save()
     user = User.objects.get(username=self.registr_data['username'])
     self.assertEqual(user.username, self.registr_data['username'])
     self.assertEqual(user.nick, self.registr_data['nick'])
     self.assertEqual(user.email, self.registr_data['email'])
     self.assertTrue(
         check_password(password=self.registr_data['password1'],
                        encoded=user.password))
Beispiel #2
0
 def setUp(self):
     self.user_data = {
         'username': '******',
         'nick': 'testowy',
         'password1': 'test123456',
         'password2': 'test123456',
         'email': '*****@*****.**',
     }
     self.change_password_data = {
         'old_password': self.user_data['password1'],
         'new_password1': 'TestChangePassword',
         'new_password2': 'TestChangePassword'
     }
     form = SignUpForm(data=self.user_data)
     self.assertTrue(form.is_valid())
     form.save()
     self.user = User.objects.get(username=self.user_data['username'])
Beispiel #3
0
 def _create_form(self):
     form = SignUpForm(data=self.registr_data)
     self.assertTrue(form.is_valid())
     form.save()