def test_success(self, password_changed):
     """Successful submission of form data"""
     data = {
         "email": "*****@*****.**",
         "full_name": "John Smith",  # optional field
         "short_name": "John",  # optional field
         "password1": "test123",
         "password2": "test123",
     }
     form = UserCreationForm(data)
     self.assertTrue(form.is_valid())
     form.save(commit=False)
     self.assertEqual(password_changed.call_count, 0)
     user = form.save()
     self.assertEqual(password_changed.call_count, 1)
     self.assertEqual(repr(user), "<User: [email protected]>")
     self.assertEqual(user.get_short_name(), "John")
     self.assertEqual(user.get_full_name(), "John Smith")
     self.assertTrue(user.check_password("test123"))
 def test_success(self, password_changed):
     """Successful submission of form data"""
     data = {
         'email': '*****@*****.**',
         'full_name': 'John Smith',  # optional field
         'short_name': 'John',  # optional field
         'password1': 'test123',
         'password2': 'test123',
     }
     form = UserCreationForm(data)
     self.assertTrue(form.is_valid())
     form.save(commit=False)
     self.assertEqual(password_changed.call_count, 0)
     user = form.save()
     self.assertEqual(password_changed.call_count, 1)
     self.assertEqual(repr(user), '<User: [email protected]>')
     self.assertEqual(user.get_short_name(), 'John')
     self.assertEqual(user.get_full_name(), 'John Smith')
     self.assertTrue(user.check_password('test123'))