test_sssctl.py revision 1a71eeb4d71f7f6d63edb4298d69b35a94edc020
#
# sssctl tool integration test
#
# Copyright (c) 2016 Red Hat, Inc.
# Author: Michal Zidek <mzidek@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 ent
import grp
import pwd
import subprocess
import pytest
import stat
import time
import signal
import ds_openldap
import ldap_ent
import config
import sssd_netgroup
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
def portable_LC_ALL(request):
return None
[sssd]
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}
ldap_netgroup_search_base = ou=Netgroups,{ldap_conn.ds_inst.base_dn}
return None
[sssd]
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]
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
def get_call_output(cmd):
return output
# Fill the cache first
'user1',
'CamelCaseUser1',
"performed") != -1
"CamelCaseUser1"])
"performed") != -1
# Fill the cache first
'user1@LDAP',
'CamelCaseUser1@LDAP',
"performed") != -1
"performed") != -1
# Fill the cache first
'user1@LDAP',
'CamelCaseUser1@LDAP',
"performed") != -1
"performed") != -1
"performed") != -1
# Fill the cache first
"group1",
"CamelCaseGroup1",
# Fill the cache first
"group1@LDAP",
"CamelCaseGroup1@LDAP",
# Fill the cache first
"group1@LDAP",
"camelcasegroup1@LDAP",
return None
assert "Name: tripled_netgroup" not in output
assert "Name: tripled_netgroup" in output