dirsrvtests/suites/basic/basic_test.py | 72 +++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
New commits:
commit 973d1d95a25439f094b1702e56f0d2a7fb7abca5
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Mon Aug 31 10:54:21 2015 +0200
Ticket 47761 - Added a few testcases to the basic testsuite
Description: New testcases test the feature that adds a posibility
to change the behavior of rootDSE searches. Namely,
the default list of returned operational attributes.
https://fedorahosted.org/389/ticket/47761
Signed-off-by: Mark Reynolds <mreynolds(a)redhat.com>
(cherry picked from commit cb950de1414e6b04bd09587bee7090a00ada15fe)
diff --git a/dirsrvtests/suites/basic/basic_test.py
b/dirsrvtests/suites/basic/basic_test.py
index c6ac74b..9aec8ef 100644
--- a/dirsrvtests/suites/basic/basic_test.py
+++ b/dirsrvtests/suites/basic/basic_test.py
@@ -31,6 +31,13 @@ USER1_DN = 'uid=user1,' + DEFAULT_SUFFIX
USER2_DN = 'uid=user2,' + DEFAULT_SUFFIX
USER3_DN = 'uid=user3,' + DEFAULT_SUFFIX
+ROOTDSE_DEF_ATTR_LIST = ('namingContexts',
+ 'supportedLDAPVersion',
+ 'supportedControl',
+ 'supportedExtension',
+ 'supportedSASLMechanisms',
+ 'vendorName',
+ 'vendorVersion')
class TopologyStandalone(object):
def __init__(self, standalone):
@@ -97,6 +104,38 @@ def import_example_ldif(topology):
assert False
+(a)pytest.fixture(params=ROOTDSE_DEF_ATTR_LIST)
+def rootdse_attr(topology, request):
+ """Adds an attr from the list
+ as the default attr to the rootDSE
+ """
+
+ RETURN_DEFAULT_OPATTR = "nsslapd-return-default-opattr"
+ rootdse_attr_name = request.param
+
+ log.info(" Add the %s: %s to rootdse" % (RETURN_DEFAULT_OPATTR,
+ rootdse_attr_name))
+ mod = [(ldap.MOD_ADD, RETURN_DEFAULT_OPATTR, rootdse_attr_name)]
+ try:
+ topology.standalone.modify_s("", mod)
+ except ldap.LDAPError as e:
+ log.fatal('Failed to add attr: error (%s)' %
(e.message['desc']))
+ assert False
+
+ def fin():
+ log.info(" Delete the %s: %s from rootdse" %
(RETURN_DEFAULT_OPATTR,
+ rootdse_attr_name))
+ mod = [(ldap.MOD_DELETE, RETURN_DEFAULT_OPATTR, rootdse_attr_name)]
+ try:
+ topology.standalone.modify_s("", mod)
+ except ldap.LDAPError as e:
+ log.fatal('Failed to delete attr: error (%s)' %
(e.message['desc']))
+ assert False
+ request.addfinalizer(fin)
+
+ return rootdse_attr_name
+
+
def test_basic_ops(topology, import_example_ldif):
"""Test doing adds, mods, modrdns, and deletes"""
@@ -695,6 +734,39 @@ def test_basic_dse(topology, import_example_ldif):
log.info('test_basic_dse: PASSED')
+(a)pytest.mark.parametrize("rootdse_attr_name", ROOTDSE_DEF_ATTR_LIST)
+def test_def_rootdse_attr(topology, import_example_ldif, rootdse_attr_name):
+ """Tests that operational attributes
+ are not returned by default in rootDSE searches
+ """
+
+ log.info(" Assert rootdse search hasn't %s attr" %
rootdse_attr_name)
+ try:
+ entries = topology.standalone.search_s("", ldap.SCOPE_BASE)
+ entry = str(entries[0])
+ assert rootdse_attr_name not in entry
+
+ except ldap.LDAPError as e:
+ log.fatal('Search failed, error: ' + e.message['desc'])
+ assert False
+
+
+def test_mod_def_rootdse_attr(topology, import_example_ldif, rootdse_attr):
+ """Tests that operational attributes are returned
+ by default in rootDSE searches after config modification
+ """
+
+ log.info(" Assert rootdse search has %s attr" % rootdse_attr)
+ try:
+ entries = topology.standalone.search_s("", ldap.SCOPE_BASE)
+ entry = str(entries[0])
+ assert rootdse_attr in entry
+
+ except ldap.LDAPError as e:
+ log.fatal('Search failed, error: ' + e.message['desc'])
+ assert False
+
+
if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
--
389 commits mailing list
389-commits@%(host_name)s
http://lists.fedoraproject.org/postorius/389-commits@lists.fedoraproject.org