diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-08-14 11:59:47 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-08-14 18:48:19 +0200 |
commit | a9b055291c39198be5fb1648ba1f51418af16e09 (patch) | |
tree | 6f8ecc276d002804272adcbbfc9b9a52af0192c2 | |
parent | c335c5f54a2bb174b558f7edaced468e597c7ed6 (diff) | |
download | samba-a9b055291c39198be5fb1648ba1f51418af16e09.tar.gz samba-a9b055291c39198be5fb1648ba1f51418af16e09.tar.bz2 samba-a9b055291c39198be5fb1648ba1f51418af16e09.zip |
s4:passwords.py - test the error code when there doesn't exist any password yet
After the creation of a user object we don't have any password yet.
-rwxr-xr-x | source4/dsdb/tests/python/passwords.py | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py index 247ed1681b..a8a19e18b4 100755 --- a/source4/dsdb/tests/python/passwords.py +++ b/source4/dsdb/tests/python/passwords.py @@ -79,14 +79,34 @@ class PasswordTests(samba.tests.TestCase): self.ldb = ldb self.base_dn = self.find_basedn(ldb) - # (Re)adds the test user "testuser" with the inital password - # "thatsAcomplPASS1" + # (Re)adds the test user "testuser" with no password atm self.delete_force(self.ldb, "cn=testuser,cn=users," + self.base_dn) self.ldb.add({ "dn": "cn=testuser,cn=users," + self.base_dn, "objectclass": ["user", "person"], - "sAMAccountName": "testuser", - "userPassword": "thatsAcomplPASS1" }) + "sAMAccountName": "testuser"}) + + # Tests a password change when we don't have a password yet + try: + self.ldb.modify_ldif(""" +dn: cn=testuser,cn=users,""" + self.base_dn + """ +changetype: modify +delete: userPassword +userPassword: thatsAcomplPASS1 +add: userPassword +userPassword: thatsAcomplPASS2 +""") + self.fail() + except LdbError, (num, _): + self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + + # Sets the initial user password and enables the account + self.ldb.modify_ldif(""" +dn: cn=testuser,cn=users,""" + self.base_dn + """ +changetype: modify +replace: userPassword +userPassword: thatsAcomplPASS1 +""") self.ldb.enable_account("(sAMAccountName=testuser)") # Open a second LDB connection with the user credentials. Use the |