diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2017-03-23 03:28:24 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2017-03-23 03:28:24 +0000 |
commit | a5efa210b291630d838878b8d5e7d2ab0bf8b384 (patch) | |
tree | 395dd27057c93ec6f91809efc770f39fd526bf9e /pw/tests/pw_lock_test.sh | |
parent | e9b9941bd76fcfbac2d1898de8f05cd48d8468ed (diff) | |
download | pw-darwin-a5efa210b291630d838878b8d5e7d2ab0bf8b384.tar.gz pw-darwin-a5efa210b291630d838878b8d5e7d2ab0bf8b384.tar.zst pw-darwin-a5efa210b291630d838878b8d5e7d2ab0bf8b384.zip |
Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme
usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Diffstat (limited to 'pw/tests/pw_lock_test.sh')
-rwxr-xr-x | pw/tests/pw_lock_test.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pw/tests/pw_lock_test.sh b/pw/tests/pw_lock_test.sh new file mode 100755 index 0000000..5ec1b09 --- /dev/null +++ b/pw/tests/pw_lock_test.sh @@ -0,0 +1,42 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test locking and unlocking a user account +atf_test_case user_locking cleanup +user_locking_body() { + populate_etc_skel + ${PW} useradd test || atf_fail "Creating test user" + ${PW} lock test || atf_fail "Locking the user" + atf_check -s exit:0 -o match:"^test:\*LOCKED\*\*:1001:" \ + grep "^test:\*LOCKED\*\*:1001:" $HOME/master.passwd + ${PW} unlock test || atf_fail "Locking the user" + atf_check -s exit:0 -o match:"^test:\*:1001:" \ + 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 +} |