'Test that ``RegistrationFormUniqueEmail`` validates uniqueness
of email addresses.'

def test_registration_form_username_lowercase(self):

    UserModel().objects.create_user(u'alice', u'alice@example.com', u'secret')
    form = forms.RegistrationFormUsernameLowercase(data={u'username': u'Alice', u'email': u'alice@example.com', u'password1': u'foo', u'password2': u'foo'})
    self.failIf(form.is_valid())
    self.assertEqual(form.errors[u'username'], [u'A    user    with    that    username    already    exists.'])
    form = forms.RegistrationFormUsernameLowercase(data={u'username': u'foo', u'email': u'alice@example.com', u'password1': u'foo', u'password2': u'foo'})
    self.failUnless(form.is_valid())
