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())
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
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())
def test_with_valid_form_data_invalid_ldap(self): with self.app.test_request_context(): form = LDAPLoginForm( username='******', password='******') self.assertFalse(form.validate())