# Path: comments/forms.py
# class SiteForm(forms.ModelForm):
# 
#     class Meta:
#         model = Site
#         exclude = ()
# 
#     def clean_domain(self):
#         p = re.compile(settings.DOMAIN_URL_PATTERN)
#         m = p.match(self.cleaned_data['domain'])
# 
#         if m:
#             self.cleaned_data['domain'] = m.groups()[1]
#         else:
#             raise forms.ValidationError(_("Enter a valid value"))
# 
#         return self.cleaned_data['domain']


from django.test import TestCase
from comments.forms import SiteForm


class SiteTestCase(TestCase):
    pass

class SiteFormTestCase(TestCase):

    def test_form_validation_success(self):
        domain = 'www.google.com'


# Path: comments/forms.py
# class SiteForm(forms.ModelForm):
# 
#     class Meta:
#         model = Site
#         exclude = ()
# 
#     def clean_domain(self):
#         p = re.compile(settings.DOMAIN_URL_PATTERN)
#         m = p.match(self.cleaned_data['domain'])
# 
#         if m:
#             self.cleaned_data['domain'] = m.groups()[1]
#         else:
#             raise forms.ValidationError(_("Enter a valid value"))
# 
#         return self.cleaned_data['domain']


# Path: comments/tests/site.py
from django.test import TestCase
from comments.forms import SiteForm



class SiteTestCase(TestCase):
    pass

class SiteFormTestCase(TestCase):

    def test_form_validation_success(self):
        domain = 'www.google.com'


        form = SiteForm(data={'domain': domain})