diff options
author | brd <brd@FreeBSD.org> | 2014-11-15 05:12:30 +0000 |
---|---|---|
committer | brd <brd@FreeBSD.org> | 2014-11-15 05:12:30 +0000 |
commit | f50123356c5aadf325ed9025a5eb00cdd6c8a6c1 (patch) | |
tree | 2b43a1263e8ace267ee53b70867b316175750bc7 /usr.sbin | |
parent | ba4a5e581c82d730ec6502f6ef6a68479c9d391d (diff) | |
download | FreeBSD-src-f50123356c5aadf325ed9025a5eb00cdd6c8a6c1.zip FreeBSD-src-f50123356c5aadf325ed9025a5eb00cdd6c8a6c1.tar.gz |
Add a test for locking and unlocking user accounts
Submitted by: Robert O'Neil <oneil.rs@gmail.com>
Reviewed by: will
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pw/tests/Makefile | 2 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_lock.sh | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/usr.sbin/pw/tests/Makefile b/usr.sbin/pw/tests/Makefile index 0391d1f..6bc9433 100644 --- a/usr.sbin/pw/tests/Makefile +++ b/usr.sbin/pw/tests/Makefile @@ -5,7 +5,7 @@ TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/usr.sbin/useradd TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_delete pw_modify pw_etcdir +ATF_TESTS_SH= pw_delete pw_lock pw_modify pw_etcdir TEST_METADATA.pw_delete+= required_user="root" TEST_METADATA.pw_modify+= required_user="root" diff --git a/usr.sbin/pw/tests/pw_lock.sh b/usr.sbin/pw/tests/pw_lock.sh new file mode 100755 index 0000000..070a6f9 --- /dev/null +++ b/usr.sbin/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 +} |