'Test that ``RegistrationFormNoFreeEmail`` disallows
registration with free email addresses.'

def test_registration_form_no_free_email(self):

    base_data = {u'username': u'foo', u'password1': u'foo', u'password2': u'foo'}
    for domain in forms.RegistrationFormNoFreeEmail.bad_domains:
        invalid_data = base_data.copy()
        invalid_data[u'email'] = (u'foo@%s' % domain)
        form = forms.RegistrationFormNoFreeEmail(data=invalid_data)
        self.failIf(form.is_valid())
        self.assertEqual(form.errors[u'email'], [u'Registration    using    free    email    addresses    is    prohibited.    Please    supply    a    different    email    address.'])
    base_data[u'email'] = u'foo@example.com'
    form = forms.RegistrationFormNoFreeEmail(data=base_data)
    self.failUnless(form.is_valid())
