示例#1
0
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#

import pytest
from lib389.dseldif import DSEldif
from lib389._constants import DN_CONFIG, LOG_REPLICA, LOG_DEFAULT, LOG_TRACE, LOG_ACL
from lib389.utils import os, logging
from lib389.topologies import topology_st as topo

DEBUGGING = os.getenv("DEBUGGING", default=False)
if DEBUGGING:
    logging.getLogger(__name__).setLevel(logging.DEBUG)
else:
    logging.getLogger(__name__).setLevel(logging.INFO)
log = logging.getLogger(__name__)


@pytest.mark.bz1460718
@pytest.mark.parametrize("log_level", [(LOG_REPLICA + LOG_DEFAULT),
                                       (LOG_ACL + LOG_DEFAULT),
                                       (LOG_TRACE + LOG_DEFAULT)])
def test_default_loglevel_stripped(topo, log_level):
    """The default log level 16384 is stripped from the log level returned to a client

    :id: c300f8f1-aa11-4621-b124-e2be51930a6b

    :setup: Standalone instance
示例#2
0
from lib389.topologies import topology_st as topo

pytestmark = pytest.mark.tier3

MEMOF_PLUGIN = ('cn=' + PLUGIN_MEMBER_OF + ',cn=plugins,cn=config')
MAN_ENTRY_PLUGIN = ('cn=' + PLUGIN_MANAGED_ENTRY + ',cn=plugins,cn=config')
AUTO_MEM_PLUGIN = ('cn=' + PLUGIN_AUTOMEMBER + ',cn=plugins,cn=config')
DOMAIN = 'redhat.com'
LDAP_MOD = '/usr/bin/ldapmodify'
FILTER = 'objectClass=*'
USER_FILTER = '(|(uid=user*)(cn=group*))'
MEMBEROF_ATTR = 'memberOf'
DN_ATTR = 'dn:'

logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)


@pytest.fixture(scope="module")
def memberof_setup(topo, request):
    """Configure required plugins and restart the server"""

    log.info('Configuring memberOf, managedEntry and autoMembers plugins and restarting the server')
    topo.standalone.simple_bind_s(DN_DM, PASSWORD)
    try:
        topo.standalone.plugins.enable(name=PLUGIN_MEMBER_OF)
    except ldap.LDAPError as e:
        log.error('Failed to enable {} plugin'.format(PLUGIN_MEMBER_OF))
        raise e
    try:
        topo.standalone.plugins.enable(name=PLUGIN_MANAGED_ENTRY)