def test_missing_mail(self): with mock_ldap() as ldap: (response, err_msg) = ldap.get_user("nomail") self.assertIsNone(response) self.assertEquals('Missing mail field "mail" in user record', err_msg)
def test_missing_mail_allowed(self): with mock_ldap(requires_email=False) as ldap: (response, _) = ldap.get_user("nomail") self.assertEquals(response.username, "nomail")
def test_bytes_in_results(self): with mock_ldap() as ldap: (response, _) = ldap.get_user("bytesuser") self.assertEqual(response.username, "bytesuser")