summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorGlen Barber <gjb@FreeBSD.org>2016-01-04 19:19:48 +0000
committerGlen Barber <gjb@FreeBSD.org>2016-01-04 19:19:48 +0000
commitffdcb58dbba641f7594de91c430bd54ff12e57fb (patch)
tree316e945fb4c41a42f8e6dd13710f7ae0cd112359 /pw/tests
parent3deb3f6771d46e43dd7306d3d2398f195dea94fa (diff)
parenta05d621a3b9a8e41b02c61a781b9d6390d6d30ec (diff)
downloadpw-darwin-ffdcb58dbba641f7594de91c430bd54ff12e57fb.tar.gz
pw-darwin-ffdcb58dbba641f7594de91c430bd54ff12e57fb.zip
MFH r289384-r293170
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'pw/tests')
-rwxr-xr-xpw/tests/pw_lock.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/pw/tests/pw_lock.sh b/pw/tests/pw_lock.sh
index 9f14e24..5ec1b09 100755
--- a/pw/tests/pw_lock.sh
+++ b/pw/tests/pw_lock.sh
@@ -16,7 +16,27 @@ user_locking_body() {
grep "^test:\*:1001:" $HOME/master.passwd
}
+atf_test_case numeric_locking cleanup
+numeric_locking_body() {
+ populate_etc_skel
+ ${PW} useradd test || atf_fail "Creating test user"
+ ${PW} lock 1001 || atf_fail "Locking the user"
+ atf_check -s exit:0 -o match:"^test:\*LOCKED\*\*:1001:" \
+ grep "^test:\*LOCKED\*\*:1001:" $HOME/master.passwd
+ ${PW} unlock 1001 || atf_fail "Unlocking the user"
+ atf_check -s exit:0 -o match:"^test:\*:1001:" \
+ grep "^test:\*:1001:" $HOME/master.passwd
+ # Now numeric names
+ ${PW} useradd -n 1001 || atf_fail "Creating test user"
+ ${PW} lock 1001 || atf_fail "Locking the user"
+ atf_check -s exit:0 -o match:"^1001:\*LOCKED\*\*:1002:" \
+ grep "^1001:\*LOCKED\*\*:1002:" $HOME/master.passwd
+ ${PW} unlock 1001 || atf_fail "Unlocking the user"
+ atf_check -s exit:0 -o match:"^1001:\*:1002:" \
+ grep "^1001:\*:1002:" $HOME/master.passwd
+}
atf_init_test_cases() {
atf_add_test_case user_locking
+ atf_add_test_case numeric_locking
}