svn commit: r274542 - head/usr.sbin/pw/tests

Brad Davis brd at FreeBSD.org
Sat Nov 15 05:12:31 UTC 2014


Author: brd (doc committer)
Date: Sat Nov 15 05:12:30 2014
New Revision: 274542
URL: https://svnweb.freebsd.org/changeset/base/274542

Log:
  Add a test for locking and unlocking user accounts
  
  Submitted by:	Robert O'Neil <oneil.rs at gmail.com>
  Reviewed by:	will

Added:
  head/usr.sbin/pw/tests/pw_lock.sh   (contents, props changed)
Modified:
  head/usr.sbin/pw/tests/Makefile

Modified: head/usr.sbin/pw/tests/Makefile
==============================================================================
--- head/usr.sbin/pw/tests/Makefile	Sat Nov 15 05:05:32 2014	(r274541)
+++ head/usr.sbin/pw/tests/Makefile	Sat Nov 15 05:12:30 2014	(r274542)
@@ -5,7 +5,7 @@ TESTSRC=	${.CURDIR}/../../../contrib/net
 
 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"

Added: head/usr.sbin/pw/tests/pw_lock.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_lock.sh	Sat Nov 15 05:12:30 2014	(r274542)
@@ -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
+}


More information about the svn-src-all mailing list