#50876 Issue:50860 - Port Password Policy test cases from TET to python3 bug624080
Closed 3 years ago by spichugi. Opened 4 years ago by aborah.
aborah/389-ds-base bug624080  into  master

@@ -17,6 +17,7 @@ 

  from lib389._constants import (DEFAULT_SUFFIX, DN_CONFIG, PASSWORD, DN_DM,

                                 HOST_STANDALONE, PORT_STANDALONE, SERVERID_STANDALONE)

  from dateutil.parser import parse as dt_parse

+ from lib389.config import Config

  import datetime

  

  pytestmark = pytest.mark.tier1
@@ -547,6 +548,50 @@ 

      assert testuser.present('shadowWarning')

  

  

+ @pytest.mark.bug624080

+ def test_password_expire_works(topology_st):

+     """Regression test for bug624080. If passwordMaxAge is set to a

+     value and a new user is added, if the passwordMaxAge is changed

+     to a shorter expiration time and the new users  password

+     is then changed ..... the passwordExpirationTime for the

+     new user should be changed too. There was a bug in DS 6.2

+     where the expirationtime remained unchanged.

+ 

+     :id: 1ead6052-4636-11ea-b5af-8c16451d917b

+     :setup: Standalone

+     :steps:

+         1. Set the Global password policy and a passwordMaxAge to 5 days

+         2. Add the new user

+         3. Check the users password expiration time now

+         4. Decrease global passwordMaxAge to 2 days

+         5. Modify the users password

+         6. Modify the user one more time to make sur etime has been reset

+         7. turn off the password policy

+     :expected results:

+         1. Success

+         2. Success

+         3. Success

+         4. Success

+         5. Success

+         6. Success

+         7. Success

+     """

+     config = Config(topology_st.standalone)

+     config.replace_many(('passwordMaxAge', '432000'),

+                         ('passwordExp', 'on'))

+     user = UserAccounts(topology_st.standalone, DEFAULT_SUFFIX, rdn=None).create_test_user()

+     user.set('userPassword', 'anuj')

+     expire_time = user.get_attr_val_utf8('passwordExpirationTime')

+     config.replace('passwordMaxAge', '172800')

+     user.set('userPassword', 'borah')

+     expire_time2 = user.get_attr_val_utf8('passwordExpirationTime')

+     config.replace('passwordMaxAge', '604800')

+     user.set('userPassword', 'anujagaiin')

+     expire_time3 = user.get_attr_val_utf8('passwordExpirationTime')

+     assert expire_time != expire_time2 != expire_time3

+     config.replace('passwordExp', 'off')

+ 

+     

  if __name__ == '__main__':

      # Run isolated

      # -s for DEBUG mode

Bug Description: Port Password Policy test cases from TET to python3 bug624080

Relates: https://pagure.io/389-ds-base/issue/50690

Author: aborah

Reviewed by: ???

Please move this test function to suites/password/pwdPolicy_warning_test.py.

rebased onto 71dfd1271f9acd6d4464da4cd1925ad1d11c2fba

4 years ago

rebased onto b7255ce

4 years ago

Pull-Request has been merged by vashirov

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3929

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata