def test_create(self):
    url = reverse('profiles.user_create')
    self.login(self.admin)
    response = self.url_post('unicef', url, dict())
    self.assertEqual(response.status_code, 200)
    self.assertFormError(response, 'form', 'full_name', 'This field is required.')
    self.assertFormError(response, 'form', 'email', 'This field is required.')
    self.assertFormError(response, 'form', 'password', 'This field is required.')
    data = {'full_name': 'Mo Polls', 'email': 'example@example.com', 'password': '123', 'confirm_password': '123'}
    response = self.url_post('unicef', url, data)
    self.assertFormError(response, 'form', 'password', 'Ensure this value has at least 8 characters (it has 3).')
    data = {'full_name': 'Mo Polls', 'email': 'example@example.com', 'password': 'Qwerty123', 'confirm_password': '123'}
    response = self.url_post('unicef', url, data)
    self.assertFormError(response, 'form', 'confirm_password', "Passwords don't match.")
    data = {'full_name': 'Mo Polls', 'email': 'example@example.com', 'password': 'Qwerty123', 'confirm_password': 'Qwerty123'}
    response = self.url_post('unicef', url, data)
    self.assertEqual(response.status_code, 302)
    user = User.objects.get(email='example@example.com')
    self.assertEqual(user.profile.full_name, 'Mo Polls')
    self.assertEqual(user.email, 'example@example.com')
    self.assertEqual(user.username, 'example@example.com')
    data = {'full_name': 'Mo Polls II', 'email': 'example@example.com', 'password': 'Qwerty123', 'confirm_password': 'Qwerty123'}
    response = self.url_post('unicef', url, data)
    self.assertFormError(response, 'form', None, 'Email address already taken.')
def test_create(self):
    url = reverse('profiles.user_create')
    self.login(self.admin)
    response = self.url_post('unicef', url, dict())
    self.assertEqual(response.status_code, 200)
    self.assertFormError(response, 'form', 'full_name', 'This field is required.')
    self.assertFormError(response, 'form', 'email', 'This field is required.')
    self.assertFormError(response, 'form', 'password', 'This field is required.')
    data = {'full_name': 'Mo Polls', 'email': 'example@example.com', 'password': '123', 'confirm_password': '123'}
    response = self.url_post('unicef', url, data)
    self.assertFormError(response, 'form', 'password', 'Ensure this value has at least 8 characters (it has 3).')
    data = {'full_name': 'Mo Polls', 'email': 'example@example.com', 'password': 'Qwerty123', 'confirm_password': '123'}
    response = self.url_post('unicef', url, data)
    self.assertFormError(response, 'form', 'confirm_password', "Passwords don't match.")
    data = {'full_name': 'Mo Polls', 'email': 'example@example.com', 'password': 'Qwerty123', 'confirm_password': 'Qwerty123'}
    response = self.url_post('unicef', url, data)
    self.assertEqual(response.status_code, 302)
    user = User.objects.get(email='example@example.com')
    self.assertEqual(user.profile.full_name, 'Mo Polls')
    self.assertEqual(user.email, 'example@example.com')
    self.assertEqual(user.username, 'example@example.com')
    data = {'full_name': 'Mo Polls II', 'email': 'example@example.com', 'password': 'Qwerty123', 'confirm_password': 'Qwerty123'}
    response = self.url_post('unicef', url, data)
    self.assertFormError(response, 'form', None, 'Email address already taken.')