#!/usr/share/ucs-test/runner python3
## desc: combination of --set pwdChangeNextLogin=0 --set password=foobar
## tags: [udm]
## roles: [domaincontroller_master]
## bugs: [42015]
## exposure: careful
## packages:
##   - univention-config
##   - univention-directory-manager-tools

import univention.testing.udm as udm_test
from univention.testing.strings import random_string
from univention.testing.utils import verify_ldap_object

if __name__ == '__main__':
	with udm_test.UCSTestUDM() as udm:
		userdn = udm.create_user(pwdChangeNextLogin=1)[0]
		verify_ldap_object(userdn, {'shadowMax': ['1']})
		udm.modify_object('users/user', dn=userdn, pwdChangeNextLogin='0', password=random_string())
		verify_ldap_object(userdn, {'shadowMax': [], 'krb5PasswordEnd': []})
