Exemplo n.º 1
0
    def test_domainuser_form_empty(self):
        """ test minimum form requirements / INVALID """

        # get object
        form = DomainuserForm(data={})
        # compare
        self.assertFalse(form.is_valid())
Exemplo n.º 2
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())
Exemplo n.º 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())
Exemplo n.º 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())