From dd47c9d782c676d2aaba2e6837a2a929b69b394b Mon Sep 17 00:00:00 2001 From: Amita Sharma Date: Wed, 6 Dec 2017 16:13:19 +0530 Subject: [PATCH] Issue 49443 - Add CI test case Description: Add a test case to suites/filter/filter_test.py. Test that ldapsearch with scope one returns only one entry. https://pagure.io/389-ds-base/issue/49443 Reviewed by: wibrown (Thanks!) --- dirsrvtests/tests/suites/filter/filter_test.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/dirsrvtests/tests/suites/filter/filter_test.py b/dirsrvtests/tests/suites/filter/filter_test.py index a6007e0..5edc365 100644 --- a/dirsrvtests/tests/suites/filter/filter_test.py +++ b/dirsrvtests/tests/suites/filter/filter_test.py @@ -12,6 +12,7 @@ import pytest from lib389.tasks import * from lib389.topologies import topology_st from lib389._constants import PASSWORD, DEFAULT_SUFFIX +from lib389.idm.user import UserAccount, UserAccounts, TEST_USER_PROPERTIES logging.getLogger(__name__).setLevel(logging.DEBUG) log = logging.getLogger(__name__) @@ -100,6 +101,31 @@ def test_filter_search_original_attrs(topology_st): log.info('test_filter_search_original_attrs: PASSED') +@pytest.mark.bz1511462 +def test_filter_scope_one(topology_st): + """Test ldapsearch with scope one gives only single entry + + :id: cf5a6078-bbe6-4d43-ac71-553c45923f91 + :setup: Standalone instance + :steps: + 1. Add a test user under default OU - ou=Special Users,dc=example,dc=com + 2. Search test user using search scope one + 3. Check that search only have one entry + :expectedresults: + 1. This should pass + 2. This should pass + 3. This should pass + """ + + parent_dn="dn: dc=example,dc=com" + child_dn="dn: cn=Directory Administrators,dc=example,dc=com" + + log.info('Search user using ldapsearch with scope one') + results = topology_st.standalone.search_s(DEFAULT_SUFFIX, ldap.SCOPE_ONELEVEL,'cn=Directory Administrators',['cn'] ) + log.info(results) + + log.info('Search should only have one entry') + assert len(results) == 1 if __name__ == '__main__': # Run isolated -- 2.9.5