# Path: nuntium/user_section/forms.py
# class WriteItInstanceBasicForm(ModelForm):
#     class Meta:
# class WriteItInstanceAnswerNotificationForm(ModelForm):
#     class Meta:
# class WriteItInstanceWebBasedForm(ModelForm):
#     class Meta:
# class WriteItInstanceModerationForm(ModelForm):
#     class Meta:
# class WriteItInstanceApiAutoconfirmForm(ModelForm):
#     class Meta:
# class WriteItInstanceMaxRecipientsForm(ModelForm):
#     class Meta:
# class WriteItInstanceRateLimiterForm(ModelForm):
#     class Meta:
# class NewAnswerNotificationTemplateForm(ModelForm):
#     class Meta:
# class ConfirmationTemplateForm(ModelForm):
#     class Meta:
# class SimpleInstanceCreateFormPopitUrl(WriteItInstanceCreateFormPopitUrl):
#     class Meta:
# class WriteItInstanceCreateForm(WriteItInstanceCreateFormPopitUrl):
#     class Meta:
# class AnswerForm(ModelForm):
#     class Meta:
# class RelatePopitInstanceWithWriteItInstance(Form, PopitParsingFormMixin):
# class WriteItPopitUpdateForm(ModelForm):
#     class Meta:
# class WebhookCreateForm(ModelForm):
#     class Meta:
#     def __init__(self, *args, **kwargs):
#     def save(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def clean_slug(self):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def relate(self):
#     def clean(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):


from global_test_case import GlobalTestCase as TestCase, popit_load_data
from ..user_section.forms import WriteItInstanceCreateFormPopitUrl, SimpleInstanceCreateFormPopitUrl
from django.contrib.auth.models import User
from django.conf import settings
from mock import patch
            'owner': self.user.id,
            'popit_url': settings.TEST_POPIT_API_URL,
            'name': "instance",
            "rate_limiter": 0,
            }
        self.form = WriteItInstanceCreateFormPopitUrl(data)

    def test_it_parses_a_simple_url(self):
        '''It parses a proper popit url'''
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api/v0.1')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api/v0.1/')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')

    def test_it_parses_a_url_without_version(self):
        '''It parses a popit url without version'''
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api/')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')

    def test_using_http_instead_of_http(self):
        '''It uses http if an https is given this should be removed ASAP
        or when we find out why it is failing'''
        popit_url = self.form.get_popit_url_parsed('https://the-instance.popit.mysociety.org/api/')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')
        popit_url = self.form.get_popit_url_parsed('https://the-instance.popit.mysociety.org/api')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')

        popit_url = self.form.get_popit_url_parsed('https://the-instance.popit.mysociety.org/api/v0.1')

# Path: nuntium/user_section/forms.py
# class WriteItInstanceBasicForm(ModelForm):
#     class Meta:
# class WriteItInstanceAnswerNotificationForm(ModelForm):
#     class Meta:
# class WriteItInstanceWebBasedForm(ModelForm):
#     class Meta:
# class WriteItInstanceModerationForm(ModelForm):
#     class Meta:
# class WriteItInstanceApiAutoconfirmForm(ModelForm):
#     class Meta:
# class WriteItInstanceMaxRecipientsForm(ModelForm):
#     class Meta:
# class WriteItInstanceRateLimiterForm(ModelForm):
#     class Meta:
# class NewAnswerNotificationTemplateForm(ModelForm):
#     class Meta:
# class ConfirmationTemplateForm(ModelForm):
#     class Meta:
# class SimpleInstanceCreateFormPopitUrl(WriteItInstanceCreateFormPopitUrl):
#     class Meta:
# class WriteItInstanceCreateForm(WriteItInstanceCreateFormPopitUrl):
#     class Meta:
# class AnswerForm(ModelForm):
#     class Meta:
# class RelatePopitInstanceWithWriteItInstance(Form, PopitParsingFormMixin):
# class WriteItPopitUpdateForm(ModelForm):
#     class Meta:
# class WebhookCreateForm(ModelForm):
#     class Meta:
#     def __init__(self, *args, **kwargs):
#     def save(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def clean_slug(self):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):
#     def __init__(self, *args, **kwargs):
#     def relate(self):
#     def clean(self, *args, **kwargs):
#     def __init__(self, *args, **kwargs):
#     def save(self, commit=True):


# Path: nuntium/tests/writeitinstance_newform_tests.py
from global_test_case import GlobalTestCase as TestCase, popit_load_data
from ..user_section.forms import WriteItInstanceCreateFormPopitUrl, SimpleInstanceCreateFormPopitUrl
from django.contrib.auth.models import User
from django.conf import settings
from mock import patch

            'owner': self.user.id,
            'popit_url': settings.TEST_POPIT_API_URL,
            'name': "instance",
            "rate_limiter": 0,
            }
        self.form = WriteItInstanceCreateFormPopitUrl(data)

    def test_it_parses_a_simple_url(self):
        '''It parses a proper popit url'''
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api/v0.1')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api/v0.1/')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')

    def test_it_parses_a_url_without_version(self):
        '''It parses a popit url without version'''
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api/')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')
        popit_url = self.form.get_popit_url_parsed('http://the-instance.popit.mysociety.org/api')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')

    def test_using_http_instead_of_http(self):
        '''It uses http if an https is given this should be removed ASAP
        or when we find out why it is failing'''
        popit_url = self.form.get_popit_url_parsed('https://the-instance.popit.mysociety.org/api/')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')
        popit_url = self.form.get_popit_url_parsed('https://the-instance.popit.mysociety.org/api')
        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')

        popit_url = self.form.get_popit_url_parsed('https://the-instance.popit.mysociety.org/api/v0.1')

        self.assertEquals(popit_url, 'https://the-instance.popit.mysociety.org/api/v0.1')