Exemplo n.º 1
0
    def test_locking(self):
        person = PersonFactory()
        self.assertTrue(person.login_enabled)

        # Test that a locked person is disabled
        person.lock()
        self.assertFalse(person.login_enabled)

        # Test that an unlocked person is enabled
        person.unlock()
        self.assertTrue(person.login_enabled)
 def test_kAccountMixin(self):
     person = PersonFactory()
     ldap = self.global_ldap_datastore._people()
     self.global_ldap_datastore.save_person(person)
     ldap_person = ldap.get(uid=person.username)
     self.assertEqual(
         ldap_person.displayName,
         six.u('%s (%s)') % (person.full_name, person.institute))
Exemplo n.º 3
0
    def test_username(self):
        assert_raises = self.assertRaises(django_exceptions.ValidationError)

        # Max length
        person = PersonFactory(username="******" * 255)
        person.full_clean()

        # Name is too long
        person = PersonFactory(username="******" * 256)
        with assert_raises:
            person.full_clean()
Exemplo n.º 4
0
    def test_username(self):
        assert_raises = self.assertRaises(django_exceptions.ValidationError)

        # Max length
        person = PersonFactory(username="******" * 255)
        person.full_clean()

        # Name is too long
        person = PersonFactory(username="******" * 256)
        with assert_raises:
            person.full_clean()
Exemplo n.º 5
0
    def test_locking(self):
        person = PersonFactory()
        self.assertTrue(person.login_enabled)

        # Test that a locked person is disabled
        person.lock()
        self.assertFalse(person.login_enabled)

        # Test that an unlocked person is enabled
        person.unlock()
        self.assertTrue(person.login_enabled)