Groups are not accessible by filter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Please consider bellow condition .

UserAccount(topo.standalone, 'cn=Accounting Managers,ou=groups,dc=example,dc=com').add('uniquemember', [
'uid=scarter, ou=People, dc=example,dc=com', 'uid=tmorris, ou=People, dc=example,dc=com', 'uid=kvaughan, ou=People, dc=example,dc=com',
'uid=rdaugherty, ou=People, dc=example,dc=com', 'uid=hmiller, ou=People, dc=example,dc=com'])

UserAccount(topo.standalone, 'cn=HR Managers,ou=groups,dc=example,dc=com').add('uniquemember', [
'uid=kvaughan, ou=People, dc=example,dc=com', 'uid=cschmith, ou=People, dc=example,dc=com'])

And try to add filter:

With Filter: It fails gives 0 result for those involves Group 'cn=Accounting Managers,ou=groups,dc=example,dc=com' .

for i in ['(uniquemember=uid=kvaughan,ou=People,dc=example,dc=com)', 
'(uniquemember=uid=rdaugherty, ou=People, dc=example,dc=com)',
'(uniquemember=uid=hmiller, ou=People, dc=example,dc=com)',
'(&(objectclass=inetorgperson)(uid=scarter))',
'(&(objectclass=organizationalperson)(uid=scarter))',
'(objectclass=inetorgperson)',
'(&(objectclass=organizationalPerson)(sn=Jensen))',
'(&(mail=*)(objectclass=organizationalPerson))',
'(mail=*)',
'(&(sn=Rentz)(objectclass=organizationalPerson))',
'(&(sn=Ward)(sn=Ward))',
'(sn=Jensen)',
'(sn=*)',
'(sn=*utz)']:
assert Accounts(topo.standalone, DEFAULT_SUFFIX).filter(i)

with search_s(Old Way): I gives correct results .

for i in ['(uniquemember=uid=kvaughan,ou=People,dc=example,dc=com)',
'(uniquemember=uid=rdaugherty, ou=People, dc=example,dc=com)',
'(uniquemember=uid=hmiller, ou=People, dc=example,dc=com)',
'(&(objectclass=inetorgperson)(uid=scarter))',
'(&(objectclass=organizationalperson)(uid=scarter))',
'(objectclass=inetorgperson)',
'(&(objectclass=organizationalPerson)(sn=Jensen))',
'(&(mail=*)(objectclass=organizationalPerson))',
'(mail=*)',
'(&(sn=Rentz)(objectclass=organizationalPerson))',
'(&(sn=Ward)(sn=Ward))',
'(sn=Jensen)',
'(sn=*)',
'(sn=*utz)']:
assert topo.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, i)


I have attached the test script too . Test test_various_combinations_of_filters_and_idlistscanlimit

Regards
Anuj Borah



# --- BEGIN COPYRIGHT BLOCK ---
# Copyright (C) 2019 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---


import os
import re
import pytest

from lib389._constants import DEFAULT_SUFFIX, PW_DM
from lib389.topologies import topology_st as topo
from lib389.idm.user import UserAccount, UserAccounts
from lib389.idm.organizationalunit import OrganizationalUnit, OrganizationalUnits
from lib389.index import Index
from lib389.idm.account import Accounts

import ldap


GIVEN_NAME = 'cn=givenname,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
CN_NAME = 'cn=sn,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
uniquemember = 'cn=uniquemember,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
objectclass = 'cn=objectclass,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
mail = 'cn=mail,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config'
ACLG_OU = f'ou=ACLGroup,{DEFAULT_SUFFIX}'
NESG_OU = f'ou=nestedgroup, {DEFAULT_SUFFIX}'

LIST_OF_USER_ACCOUNTING = [
    f"uid=Ted Morris, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=David Miller, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Gern Farmer, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Judy Wallace, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Marcus Ward, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Judy McFarland, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Anuj Hall, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Gern Triplett, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Emanuel Johnson, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Brad Walker, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Tobias Pierce, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Randy Mills, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=David Thorud, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Elba Kohler, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Laurel Campbell, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Torrey Schneider, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Paula Rose, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Frank Albers, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Martin Schneider, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Andrew Hel, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Pete Tyler, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Randy Ulrich, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Richard Francis, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Morgan White, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Anuj Maddox, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Jody Jensen, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Mike Carter, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Gern Tyler, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Bjorn Jensen, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Andy Hall, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Ted Jensen, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Wendy Lutz, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Kelly Mcinnis, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Trent Couzens, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Dan Lanoway, ou=Accounting,{DEFAULT_SUFFIX}",
    f"uid=Richard Jensen, ou=Accounting,{DEFAULT_SUFFIX}"]

LIST_OF_USER_HUMAN = [
    f"uid=Kirsten Vaughan, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Chris Schmith, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Torrey Clow, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Robert Daugherty, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Torrey Mason, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Brad Talbot, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Anuj Jablonski, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Harry Miller, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Jeffrey Campaigne, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Stephen Triplett, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=John Falena, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Peter Rigden, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Mike Lott, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Richard Bannister, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Brian Plante, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Daniel Smith, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Tim Labonte, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Scott Lee, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Bjorn Free, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Alexander Shelton, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=James Burrell, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Karen Carter, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Randy Fish, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Philip Hunt, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Rachel Schneider, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Gern Jensen, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=David Akers, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Tobias Ward, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Jody Rentz, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Peter Lorig, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Kelly Schmith, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Pete Worrell, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Matthew Reuter, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Tobias Schmith, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Jon Goldstein, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Janet Lutz, ou=Human Resources,{DEFAULT_SUFFIX}",
    f"uid=Karl Cope, ou=Human Resources,{DEFAULT_SUFFIX}",
]

LIST_OF_USER_TESTING = [
    f"uid=Andy Bergin, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=John Walker, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Jayne Reuter, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Lee Ulrich, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Benjamin Schneider, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Bertram Rentz, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Patricia Cruse, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Jim Lange, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Alan White, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Daniel Ward, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Lee Stockton, ou=Product Testing,{DEFAULT_SUFFIX}",
    f"uid=Matthew Vaughan, ou=Product Testing,{DEFAULT_SUFFIX}"
]

LIST_OF_USER_DEVELOPMENT = [
    f"uid=Kelly Winters, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Torrey Rigden, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Benjamin Hall, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Lee Labonte, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Jody Campaigne, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Alexander Lutz, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Bjorn Talbot, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Marcus Langdon, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Sue Peterson, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Kurt Jensen, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Cecil Wallace, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Stephen Carter, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Janet Hunter, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Marcus Mcinnis, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Timothy Kelly, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Sue Mason, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Chris Alexander, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Anuj Jensen, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Martin Talbot, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Scott Farmer, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Allison Jensen, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Jeff Muffly, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Alan Worrell, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Dan Langdon, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Ashley Knutson, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Jon Bourke, ou=Product Development,{DEFAULT_SUFFIX}",
    f"uid=Pete Hunt, ou=Product Development,{DEFAULT_SUFFIX}",

]

LIST_OF_USER_PAYROLL = [
    f"uid=Ashley Chassin, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Sue Kelleher, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Jim Cruse, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Judy Brown, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Patricia Shelton, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Dietrich Swain, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Allison Hunter, ou=Payroll,{DEFAULT_SUFFIX}",
    f"uid=Anne-Louise Barnes, ou=Payroll,{DEFAULT_SUFFIX}"

]


@pytest.mark.skip(reason="https://pagure.io/389-ds-base/issue/50201";)
def test_error_handling_for_invalid_configuration(topo):
    """"
    Error handling for invalid configuration
    Starting...test cases for bug1011539
    Index config error handling does not exist - you can add any old thing
    :id:377950f6-9f06-11e8-831b-8c16451d917b
    :setup: Standalone instance
    :steps:
         1. Create Instance
         2. Try change nsIndexIDListScanLimit
    :expectedresults:
         1. This should pass
         2. This should pass
    """
    for i in ['4000', 'limit=0 flags=bogus', 'limit=0 limit=1', 'limit=0 type=eq type=eq', 'limit=0 type=sub type=eq',
              'limit=0 flags=AND flags=AND', 'limit=0 type=eq values=foo values=foo', 'limit=0 type=eq values=foo,foo',
              'limit=0 type=sub', 'limit=0 type=eq values=notvalid', 'limit', 'limit=0 type=eq values=notavaliddn',
              'limit=0 type=pres values=bogus', 'limit=0 type=eq,sub values=bogus', 'limit=', 'limit=1 type=',
              'limit=1 flags=', 'limit=1 type=eq values=', 'limit=-2', 'type=eq', 'limit=0 type=bogus']:
        Index(topo.standalone, GIVEN_NAME).replace('nsIndexIDListScanLimit', i)


def test_various_combinations_of_filters_and_idlistscanlimit(topo):
    """
    Test various combinations of filters and idlistscanlimit
    Starting...test cases for bug1011539
    :id:44f83e2c-9f06-11e8-bffe-8c16451d917b
    :setup: Standalone instance
    :steps:
         1. Create Instance
         2. Create entries
         3. Try change nsslapd-errorlog-levelva
         4. Search created entries
         5. restart instance
         6. Search created entries
    :expectedresults:
         1. This should pass
         2. This should pass
         3. This should pass
         4. This should pass
         5. This should pass
    """
    ous = OrganizationalUnits(topo.standalone, DEFAULT_SUFFIX)
    for demo in ['Product Development', 'Accounting', 'Human Resources', 'Payroll', 'Product Testing']:
        ous.create(properties={'ou': demo})

    users_accounts = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn='ou=Accounting')
    users_human = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn='ou=Human Resources')
    users_testing = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn='ou=Product Testing')
    users_development = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn='ou=Product Development')
    users_payroll = UserAccounts(topo.standalone, DEFAULT_SUFFIX, rdn='ou=Payroll')
    users_people = UserAccounts(topo.standalone, DEFAULT_SUFFIX)

    for demo1 in LIST_OF_USER_ACCOUNTING:
        users_accounts.create(properties={
            'uid': demo1.split(',')[0].split('=')[1],
            'cn': demo1.split(',')[0].split('=')[1],
            'sn': demo1.split(',')[0].split(' ')[1],
            'uidNumber': str(1000),
            'gidNumber': '2000',
            'homeDirectory': '/home/' + demo1,
            'givenname': demo1.split(',')[0].split('=')[1].split(' ')[0],
            'userpassword': PW_DM
        })

    for demo1 in LIST_OF_USER_HUMAN:
        users_human.create(properties={
            'uid': demo1.split(',')[0].split('=')[1],
            'cn': demo1.split(',')[0].split('=')[1],
            'sn': demo1.split(',')[0].split(' ')[1],
            'uidNumber': str(1000),
            'gidNumber': '2000',
            'homeDirectory': '/home/' + demo1,
            'givenname': demo1.split(',')[0].split('=')[1].split(' ')[0],
            'userpassword': PW_DM
        })

    for demo1 in LIST_OF_USER_TESTING:
        users_testing.create(properties={
            'uid': demo1.split(',')[0].split('=')[1],
            'cn': demo1.split(',')[0].split('=')[1],
            'sn': demo1.split(',')[0].split(' ')[1],
            'uidNumber': str(1000),
            'gidNumber': '2000',
            'homeDirectory': '/home/' + demo1,
            'givenname': demo1.split(',')[0].split('=')[1].split(' ')[0],
            'userpassword': PW_DM
        })

    for demo1 in LIST_OF_USER_DEVELOPMENT:
        users_development.create(properties={
            'uid': demo1.split(',')[0].split('=')[1],
            'cn': demo1.split(',')[0].split('=')[1],
            'sn': demo1.split(',')[0].split(' ')[1],
            'uidNumber': str(1000),
            'gidNumber': '2000',
            'homeDirectory': '/home/' + demo1,
            'givenname': demo1.split(',')[0].split('=')[1].split(' ')[0],
            'userpassword': PW_DM
        })

    for demo1 in LIST_OF_USER_PAYROLL:
        users_payroll.create(properties={
            'uid': demo1.split(',')[0].split('=')[1],
            'cn': demo1.split(',')[0].split('=')[1],
            'sn': demo1.split(',')[0].split(' ')[1],
            'uidNumber': str(1000),
            'gidNumber': '2000',
            'homeDirectory': '/home/' + demo1,
            'givenname': demo1.split(',')[0].split('=')[1].split(' ')[0],
            'userpassword': PW_DM
        })

    users_people.create(properties = {
        'uid': 'scarter',
        'cn': 'Sam Carter',
        'sn': 'Carter',
        'uidNumber': str(1000),
        'gidNumber': '2000',
        'homeDirectory': '/home/' + 'scarter',
        'mail': 'scarter@xxxxxxxx',
    })

    topo.standalone.config.set('nsslapd-errorlog-level', '524288')

    for i in ['limit=1 type=eq values=Lutz,Hunter', 'limit=2 type=eq flags=AND values=Jensen,Rentz', 'limit=3 type=eq flags=AND',
              'limit=4 type=eq', 'limit=5 flags=AND', 'limit=6', 'limit=1 type=sub values=*utz,*ter', 'limit=4 type=sub',
              'limit=2 type=sub flags=AND values=*sen,*ntz', 'limit=3 type=sub flags=AND', 'limit=5 type=sub values=*sch*']:
        Index(topo.standalone, CN_NAME).replace('nsIndexIDListScanLimit', i)

    for i in ['limit=1 type=eq values=Andy,Andrew', 'limit=2 type=eq flags=AND values=Bjorn,David', 'limit=3 type=eq flags=AND',
              'limit=4 type=eq', 'limit=5 flags=AND', 'limit=6']:
        Index(topo.standalone, GIVEN_NAME).replace('nsIndexIDListScanLimit', i)

    Index(topo.standalone, uniquemember).replace('nsIndexIDListScanLimit', 'limit=0 type=eq values=uid=kvaughan\2Cou=People\2Cdc=example\2Cdc=com,uid=rdaugherty\2Cou=People\2Cdc=example\2Cdc=com')

    Index(topo.standalone, objectclass).replace('nsIndexIDListScanLimit', 'limit=0 type=eq flags=AND values=inetOrgPerson')

    Index(topo.standalone, mail).replace('nsIndexIDListScanLimit', 'cn=mail,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config')

    for i in ['(sn=Lutz)', '(sn=*ter)', '(&(sn=*sen)(objectclass=organizationalPerson))', '(&(objectclass=organizationalPerson)(sn=*ntz))',
              '(&(sn=Car*)(objectclass=organizationalPerson))', '(sn=sc*)', '(sn=*sch*)', '(|(givenname=Andy)(givenname=Andrew))',
              '(&(givenname=Bjorn)(objectclass=organizationalPerson))', '(&(objectclass=organizationalPerson)(givenname=David))',
              '(&(sn=*)(cn=*))', '(sn=Hunter)', '(&(givenname=Richard)(objectclass=organizationalPerson))', '(givenname=Anuj)',
              '(&(givenname=*)(cn=*))', '(givenname=*)']:
        assert Accounts(topo.standalone, DEFAULT_SUFFIX).filter(f'{i}')

    UserAccount(topo.standalone, 'cn=Accounting Managers,ou=groups,dc=example,dc=com').add('uniquemember', [
        'uid=scarter, ou=People, dc=example,dc=com', 'uid=tmorris, ou=People, dc=example,dc=com', 'uid=kvaughan, ou=People, dc=example,dc=com',
        'uid=rdaugherty, ou=People, dc=example,dc=com', 'uid=hmiller, ou=People, dc=example,dc=com'])

    UserAccount(topo.standalone, 'cn=HR Managers,ou=groups,dc=example,dc=com').add('uniquemember', [
        'uid=kvaughan, ou=People, dc=example,dc=com', 'uid=cschmith, ou=People, dc=example,dc=com'])

    for i in ['(uniquemember=uid=kvaughan,ou=People,dc=example,dc=com)',
              '(uniquemember=uid=rdaugherty, ou=People, dc=example,dc=com)',
              '(uniquemember=uid=hmiller, ou=People, dc=example,dc=com)',
              '(&(objectclass=inetorgperson)(uid=scarter))',
              '(&(objectclass=organizationalperson)(uid=scarter))',
              '(objectclass=inetorgperson)',
              '(&(objectclass=organizationalPerson)(sn=Jensen))',
              '(&(mail=*)(objectclass=organizationalPerson))',
              '(mail=*)',
              '(&(sn=Rentz)(objectclass=organizationalPerson))',
              '(&(sn=Ward)(sn=Ward))',
              '(sn=Jensen)',
              '(sn=*)',
              '(sn=*utz)']:
        assert Accounts(topo.standalone, DEFAULT_SUFFIX).filter(i)
        
    assert len(topo.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(&(sn=Hunter)(sn=Rentz))')) == 0

    UserAccount(topo.standalone, 'cn=config').replace('nsslapd-errorlog-level', '0')


def test_see_if_indexing_works_after_restart(topo):
    """
    Test restart ds, then see if indexing works after restart
    To test primarily for ticket 47831 bugs 1113605 1113606
    :id:4d947816-9f06-11e8-8ebf-8c16451d917b
    :setup: Standalone instance
    :steps:
         1. Create Instance
         2. Create entries
         3. Try change nsslapd-errorlog-levelva
         4. Search created entries
         5. restart instance
         6. Search created entries
    :expectedresults:
         1. This should pass
         2. This should pass
         3. This should pass
         4. This should pass
         5. This should pass
    """
    topo.standalone.restart()
    for i in ['uniquemember=uid=kvaughan, ou=People, dc=example,dc=com', 'uniquemember=uid=rdaugherty, ou=People, dc=example,dc=com',
              'uniquemember=uid=hmiller, ou=People, dc=example,dc=com', '(&(objectclass=inetorgperson)(uid=scarter))',
              '(&(objectclass=organizationalperson)(uid=scarter))', 'objectclass=inetorgperson', '(&(objectclass=organizationalPerson)(sn=Jensen))',
              '(&(mail=*)(objectclass=organizationalPerson))', 'mail=*', '(&(sn=Rentz)(objectclass=organizationalPerson))',
              '(&(sn=Ward)(sn=Ward))', 'sn=Jensen', 'sn=*', 'sn=*utz']:
        assert topo.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, i)
    assert len(topo.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(&(sn=Hunter)(sn=Rentz))')) == 0
    for i in ['sn=Lutz', 'sn=*ter', '(&(sn=*sen)(objectclass=organizationalPerson))', '(&(objectclass=organizationalPerson)(sn=*ntz))',
              '(&(sn=Car*)(objectclass=organizationalPerson))', 'sn=sc*', 'sn=*sch*', '(|(givenname=Andy)(givenname=Andrew))',
              '(&(givenname=Bjorn)(objectclass=organizationalPerson))', '(&(objectclass=organizationalPerson)(givenname=David))',
              '(&(sn=*)(cn=*))', 'sn=Hunter', '(&(givenname=Richard)(objectclass=organizationalPerson))', 'givenname=Anuj',
              '(&(givenname=*)(cn=*))', 'givenname=*']:
        assert topo.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, i)


if __name__ == '__main__':
    CURRENT_FILE = os.path.realpath(__file__)
    pytest.main("-s -v %s" % CURRENT_FILE)
_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/389-devel@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux