Пример #1
0
    def test_domainuser_name_form_filled(self):
        """ test minimum form requirements / INVALID """

        # get object
        form = DomainuserForm(data={'domainuser_name': 'domainuser_1'})
        # compare
        self.assertFalse(form.is_valid())
Пример #2
0
    def test_domainuser_form_empty(self):
        """ test minimum form requirements / INVALID """

        # get object
        form = DomainuserForm(data={})
        # compare
        self.assertFalse(form.is_valid())
Пример #3
0
    def test_domainuser_domain_form_filled(self):
        """ test minimum form requirements / VALID """

        # get foreign key object id
        domain_id = Domain.objects.get(domain_name='domain_1').domain_id
        # get object
        form = DomainuserForm(data={
            'domainuser_name': 'domainuser_1',
            'domain': domain_id,
        })
        # compare
        self.assertTrue(form.is_valid())
Пример #4
0
    def test_domainuser_name_too_many_chars(self):
        """test for max length"""

        # get foreign key object id
        domain_id = Domain.objects.get(domain_name='domain_1').domain_id
        # get object
        form = DomainuserForm(data={
            'domainuser_name': 'd' * 51,
            'domain': domain_id,
        })
        # compare
        self.assertFalse(form.is_valid())
Пример #5
0
    def test_domainuser_domain_form_label(self):
        """ test form label """

        # get object
        form = DomainuserForm()
        # compare
        self.assertEquals(form.fields['domain'].label, 'Domain (*)')
Пример #6
0
    def test_domainuser_system_was_logged_on_form_label(self):
        """ test form label """

        # get object
        form = DomainuserForm()
        # compare
        self.assertEqual(form.fields['system_was_logged_on'].label, 'Systems where this domainuser was logged on')