예제 #1
0
    def test_dnsname_name_form_filled(self):
        """ test minimum form requirements / VALID """

        # get object
        form = DnsnameForm(data={'dnsname_name': 'dnsname_1'})
        # compare
        self.assertTrue(form.is_valid())
예제 #2
0
    def test_dnsname_form_empty(self):
        """ test minimum form requirements / INVALID """

        # get object
        form = DnsnameForm(data={})
        # compare
        self.assertFalse(form.is_valid())
예제 #3
0
    def test_dnsname_name_too_many_chars(self):
        """test for max length"""

        # get object
        form = DnsnameForm(data={'dnsname_name': 'd' * 101})
        # compare
        self.assertFalse(form.is_valid())
예제 #4
0
    def test_dnsname_name_proper_chars(self):
        """test for max length"""

        # get object
        form = DnsnameForm(data={'dnsname_name': 'd' * 100})
        # compare
        self.assertTrue(form.is_valid())
예제 #5
0
    def test_dnsname_note_form_filled(self):
        """ test additional form content """

        # get object
        form = DnsnameForm(data={
            'dnsname_name': 'dnsname_1',
            'dnsname_note': 'lorem ipsum',
        })
        # compare
        self.assertTrue(form.is_valid())
예제 #6
0
    def test_dnsname_domain_form_filled(self):
        """ test additional form content """

        # get foreign key object id
        domain_id = Domain.objects.get(domain_name='domain_1').domain_id
        # get object
        form = DnsnameForm(data={
            'dnsname_name': 'dnsname_1',
            'domain': domain_id,
        })
        # compare
        self.assertTrue(form.is_valid())