diff options
author | 2014-11-15 05:12:30 +0000 | |
---|---|---|
committer | 2014-11-15 05:12:30 +0000 | |
commit | 05bfd29f9b6e162552771d9d260c2b08c4380fbc (patch) | |
tree | e7a91a64d2d212ed7e438a17c77c8d7d9e3c97c4 /pw/tests/pw_lock.sh | |
parent | bcd9ef6b1872f72a7932f3a2554348ec81e7e42d (diff) | |
download | pw-darwin-05bfd29f9b6e162552771d9d260c2b08c4380fbc.tar.gz pw-darwin-05bfd29f9b6e162552771d9d260c2b08c4380fbc.tar.zst pw-darwin-05bfd29f9b6e162552771d9d260c2b08c4380fbc.zip |
Add a test for locking and unlocking user accounts
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Reviewed by: will
Diffstat (limited to 'pw/tests/pw_lock.sh')
-rwxr-xr-x | pw/tests/pw_lock.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pw/tests/pw_lock.sh b/pw/tests/pw_lock.sh new file mode 100755 index 0000000..070a6f9 --- /dev/null +++ b/pw/tests/pw_lock.sh @@ -0,0 +1,22 @@ +# $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 -V ${HOME} useradd test || atf_fail "Creating test user" + pw -V ${HOME} 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 -V ${HOME} unlock test || atf_fail "Locking the user" + atf_check -s exit:0 -o match:"^test:\*:1001:" \ + grep "^test:\*:1001:" $HOME/master.passwd +} + + +atf_init_test_cases() { + atf_add_test_case user_locking +} |