Beispiel #1
0
 def test_unique(self):
     """Checks if username exists before saving."""
     self.profile.username = '******'
     self.profile.save()
     form = UsernameUpdateForm(instance=self.profile, data=self.data)
     self.assertFalse(form.is_valid())
     self.assertTrue('username' in form.errors)
 def test_unique(self):
     """Checks if username exists before saving."""
     self.profile.username = '******'
     self.profile.save()
     form = UsernameUpdateForm(instance=self.profile, data=self.data)
     self.assertFalse(form.is_valid())
     self.assertTrue('username' in form.errors)
Beispiel #3
0
 def test_form(self):
     """Should save the username."""
     form = UsernameUpdateForm(instance=self.profile, data=self.data)
     self.assertTrue(form.is_valid(),
                     msg=('Errors: {0}'.format(form.errors.items())))
     instance = form.save()
     self.assertEqual(instance.username, 'foobar')
 def test_form(self):
     """Should save the username."""
     form = UsernameUpdateForm(instance=self.profile, data=self.data)
     self.assertTrue(form.is_valid(), msg=(
         'Errors: {0}'.format(form.errors.items())))
     instance = form.save()
     self.assertEqual(instance.username, 'foobar')