From cc315714ed23a9fe25a464853e3baac4011feb35 Mon Sep 17 00:00:00 2001 From: Sankar Ramalingam Date: Thu, 17 Aug 2017 11:26:56 +0530 Subject: [PATCH] Ticket #48081 - Add regression tests for pwpolicy Description: Adding two more tests which will validate OU and Givenname attributes for userPassword. https://pagure.io/389-ds-base/issue/48081 Reviewed by: ? --- .../tests/suites/password/regression_test.py | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/dirsrvtests/tests/suites/password/regression_test.py b/dirsrvtests/tests/suites/password/regression_test.py index e2cbecc..eeed135 100644 --- a/dirsrvtests/tests/suites/password/regression_test.py +++ b/dirsrvtests/tests/suites/password/regression_test.py @@ -18,8 +18,12 @@ else: logging.getLogger(__name__).setLevel(logging.INFO) log = logging.getLogger(__name__) -TEST_PASSWORDS = ('CN12pwtest31', 'SN3pwtest231', 'UID1pwtest123', 'MAIL2pwtest12@redhat.com') -user_data = {'cn': 'CNpwtest1', 'sn': 'SNpwtest1', 'uid': 'UIDpwtest1', 'mail': 'MAILpwtest1@redhat.com'} +user_data = {'cn': 'CNpwtest1', 'sn': 'SNpwtest1', 'uid': 'UIDpwtest1', 'mail': 'MAILpwtest1@redhat.com', + 'givenname': 'GNpwtest1'} +TEST_PASSWORDS1 = list(user_data.values()) +TEST_PASSWORDS1.append('People') +TEST_PASSWORDS2 = ( + 'CN12pwtest31', 'SN3pwtest231', 'UID1pwtest123', 'MAIL2pwtest12@redhat.com', '2GN1pwtest123', 'People123') @pytest.fixture(scope="module") @@ -67,17 +71,17 @@ def test_user(topo, request): @pytest.mark.bz1465600 -@pytest.mark.parametrize("user_pasw", (user_data.values())) +@pytest.mark.parametrize("user_pasw", TEST_PASSWORDS1) def test_trivial_passw_check(topo, passw_policy, test_user, user_pasw): - """PasswordCheckSyntax attribute fails to validate cn, sn, uid and mail attributes + """PasswordCheckSyntax attribute fails to validate cn, sn, uid, givenname, ou and mail attributes :id: bf9fe1ef-56cb-46a3-a6f8-5530398a06dc :feature: Password policy :setup: Standalone instance. :steps: 1. Configure password policy with PasswordCheckSyntax set to on. - 2. Add users with cn, sn, uid, mail and userPassword attributes. + 2. Add users with cn, sn, uid, givenname, mail and userPassword attributes. 3. Configure subtree password policy for ou=people subtree. - 4. Reset userPassword with trivial values like cn, sn, uid and mail. + 4. Reset userPassword with trivial values like cn, sn, uid, givenname, ou and mail attributes. :expectedresults: 1. Enabling PasswordCheckSyntax should PASS. 2. Add users should PASS. @@ -98,20 +102,20 @@ def test_trivial_passw_check(topo, passw_policy, test_user, user_pasw): @pytest.mark.bz1468284 -@pytest.mark.parametrize("user_pasw", TEST_PASSWORDS) +@pytest.mark.parametrize("user_pasw", TEST_PASSWORDS2) def test_cn_sn_like_passw(topo, passw_policy, test_user, user_pasw): - """Passwords rejected if its similar to uid, cn, sn or mail attributes + """Passwords rejected if its similar to uid, cn, sn, givenname, ou and mail attributes :id: dfd6cf5d-8bcd-4895-a691-a43ad9ec1be8 :feature: Password policy :setup: Standalone instance :steps: 1. Configure password policy with PasswordCheckSyntax set to on - 2. Add users with cn, sn, uid, mail and userPassword attributes - 3. Replace userPassword similar to cn, sn, uid and mail attribute + 2. Add users with cn, sn, uid, mail, givenname and userPassword attributes + 3. Replace userPassword similar to cn, sn, uid, givenname, ou and mail attributes :expectedresults: 1. Enabling PasswordCheckSyntax should PASS. 2. Add users should PASS. - 3. Resetting userPasswords similar to cn, sn, uid and mail should PASS. + 3. Resetting userPasswords similar to cn, sn, uid, givenname, ou and mail attributes should PASS. """ log.info('Configure Pwpolicy with PasswordCheckSyntax and nsslapd-pwpolicy-local set to off') -- 2.7.4