test_memory_cache.py revision cb8c24707275c5bda7310d67e7f46c75d3ac36ea
#
# LDAP integration test
#
# Copyright (c) 2015 Red Hat, Inc.
# Author: Lukas Slebodnik <lslebodn@redhat.com>
#
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 only
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
import stat
import ent
import config
import signal
import subprocess
import time
import pytest
import ds_openldap
import ldap_ent
import sssd_id
LDAP_BASE_DN = "dc=example,dc=com"
"""LDAP server instance fixture"""
"cn=admin", "Secret123")
try:
except:
raise
return ds_inst
"""LDAP server connection fixture"""
return ldap_conn
"""Add LDAP entries and add teardown for removing them"""
def teardown():
"""Generate sssd.conf and add teardown for removing it"""
def stop_sssd():
while True:
try:
except:
break
def create_sssd_fixture(request):
"""Start sssd and add teardown for stopping it and removing state"""
raise Exception("sssd start failed")
def teardown():
try:
except:
pass
[sssd]
config_file_version = 2
domains = LDAP
services = nss
[nss]
ldap_auth_disable_tls_never_use_in_production = true
ldap_schema = rfc2307
id_provider = ldap
auth_provider = ldap
sudo_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
return None
[sssd]
config_file_version = 2
domains = LDAP
services = nss
[nss]
ldap_auth_disable_tls_never_use_in_production = true
ldap_schema = rfc2307
id_provider = ldap
auth_provider = ldap
sudo_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
use_fully_qualified_names = true
return None
[sssd]
config_file_version = 2
domains = LDAP
services = nss
[nss]
ldap_auth_disable_tls_never_use_in_production = true
ldap_schema = rfc2307
id_provider = ldap
auth_provider = ldap
sudo_provider = ldap
ldap_uri = {ldap_conn.ds_inst.ldap_url}
ldap_search_base = {ldap_conn.ds_inst.base_dn}
use_fully_qualified_names = true
case_sensitive = false
return None
'user1',
1001,
'user2',
1002,
'user3',
1003,
'user11',
1011,
'user12',
1012,
'user13',
1013,
'user21',
1021,
'user22',
1022,
'user23',
1023,
"group1",
2001,
"group2",
2002,
"group3",
2003,
"group0x",
2000,
"group1x",
2010,
"group2x",
2020,
"result: %s\n expected %s" % (
)
"result: %s\n expected %s" % (
)
# Just last invocation of initgroups shoudl PASS
# Otherwise, we would not be able to invalidate it
user1_case1 = 'User1@LDAP'
user1_case2 = 'uSer1@LDAP'
user1_case_last = 'usEr1@LDAP'
primary_gid = 2001
user1_case1 = 'usEr1@LDAP'
user1_case2 = 'User1@LDAP'
user1_case_last = 'uSer1@LDAP'
primary_gid = 2001
user1_case1 = 'uSer1@LDAP'
user1_case2 = 'usEr1@LDAP'
user1_case_last = 'User1@LDAP'
primary_gid = 2001