예제 #1
0
    def test_save_user_in_form(self):
        users = {}

        @self.manager.save_user
        def user_saver(dn, username, data, memberships):
            users[dn] = data
            return users[dn]

        with self.app.test_request_context():
            form = LDAPLoginForm(username='******',
                                 password='******')
            self.assertTrue(form.validate())
            assert form.user['dn'] in users

            form = LDAPLoginForm(username='******',
                                 password='******')
            self.assertFalse(form.validate())
    def test_save_user_in_form(self):
        users = {}

        @self.manager.save_user
        def user_saver(dn, username, data, memberships):
            users[dn] = data
            return users[dn]

        with self.app.test_request_context():
            form = LDAPLoginForm(
                username='******', password='******')
            self.assertTrue(form.validate())
            assert form.user['dn'] in users

            form = LDAPLoginForm(
                username='******', password='******')
            self.assertFalse(form.validate())
예제 #3
0
    def test_save_user_in_form(self):
        users = {}

        @self.manager.save_user
        def user_saver(dn, username, data, memberships):
            users[dn] = data
            return data

        with self.app.test_request_context():
            form = LDAPLoginForm(username="******", password="******")
            self.assertTrue(form.validate())
            assert form.user["dn"] in users
예제 #4
0
 def test_with_valid_form_data_invalid_ldap(self):
     with self.app.test_request_context():
         form = LDAPLoginForm(username='******',
                              password='******')
         self.assertFalse(form.validate())
예제 #5
0
 def test_invalid_form_data(self):
     with self.app.test_request_context():
         form = LDAPLoginForm(password='******')
         self.assertFalse(form.validate())
 def test_with_valid_form_data_invalid_ldap(self):
     with self.app.test_request_context():
         form = LDAPLoginForm(
             username='******', password='******')
         self.assertFalse(form.validate())
 def test_invalid_form_data(self):
     with self.app.test_request_context():
         form = LDAPLoginForm(password='******')
         self.assertFalse(form.validate())