Esempio n. 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())
Esempio n. 2
0
    def test_dnsname_note_form_label(self):
        """ test form label """

        # get object
        form = DnsnameForm()
        # compare
        self.assertEquals(form.fields['dnsname_note'].label, 'Note')
Esempio n. 3
0
    def test_dnsname_form_empty(self):
        """ test minimum form requirements / INVALID """

        # get object
        form = DnsnameForm(data={})
        # compare
        self.assertFalse(form.is_valid())
Esempio n. 4
0
    def test_dnsname_domain_form_label(self):
        """ test form label """

        # get object
        form = DnsnameForm()
        # compare
        self.assertEquals(form.fields['domain'].label, 'Domain')
Esempio n. 5
0
    def test_dnsname_name_form_label(self):
        """ test form label """

        # get object
        form = DnsnameForm()
        # compare
        self.assertEqual(form.fields['dnsname_name'].label, 'DNS name (*)')
Esempio n. 6
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())
Esempio n. 7
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())
Esempio n. 8
0
    def test_dnsname_domain_form_label(self):
        """ test form label """

        # get object
        form = DnsnameForm()
        # compare
        self.assertEqual(form.fields['domain'].label, 'Domain')
        self.assertEqual(form.fields['domain'].empty_label,
                         'Select domain (optional)')
Esempio n. 9
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())
Esempio n. 10
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())