Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2014 00:16:24 +0000 (UTC)
From:      Brad Davis <brd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272578 - head/usr.sbin/pw/tests
Message-ID:  <201410060016.s960GOWO005239@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brd (doc committer)
Date: Mon Oct  6 00:16:23 2014
New Revision: 272578
URL: https://svnweb.freebsd.org/changeset/base/272578

Log:
  - Add some tests for modifying groups
  
  Reviewed by:	will

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

Modified: head/usr.sbin/pw/tests/Makefile
==============================================================================
--- head/usr.sbin/pw/tests/Makefile	Sun Oct  5 23:32:58 2014	(r272577)
+++ head/usr.sbin/pw/tests/Makefile	Mon Oct  6 00:16:23 2014	(r272578)
@@ -2,7 +2,7 @@
 
 TESTSDIR=	${TESTSBASE}/usr.sbin/pw
 
-ATF_TESTS_SH=	pw_delete
+ATF_TESTS_SH=	pw_delete pw_modify
 
 FILES=		group helper_functions.shin master.passwd
 FILESDIR=       ${TESTSDIR}

Added: head/usr.sbin/pw/tests/pw_modify.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_modify.sh	Mon Oct  6 00:16:23 2014	(r272578)
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+
+# Test adding & removing a user from a group
+atf_test_case groupmod_user
+groupmod_user_body() {
+	populate_etc_skel
+	atf_check -s exit:0 pw -V ${HOME} addgroup test
+	atf_check -s exit:0 pw -V ${HOME} groupmod test -m root
+	atf_check -s exit:0 -o match:"^test:\*:1001:root$" \
+		grep "^test:\*:.*:root$" $HOME/group
+	atf_check -s exit:0 pw -V ${HOME} groupmod test -d root
+	atf_check -s exit:0 -o match:"^test:\*:1001:$" \
+		grep "^test:\*:.*:$" $HOME/group
+}
+
+
+# Test adding and removing a user that does not exist
+atf_test_case groupmod_invalid_user
+groupmod_invalid_user_body() {
+	populate_etc_skel
+	atf_check -s exit:0 pw -V ${HOME} addgroup test
+	atf_check -s exit:67 -e match:"does not exist" pw -V ${HOME} groupmod test -m foo
+	atf_check -s exit:0  pw -V ${HOME} groupmod test -d foo
+}
+
+
+atf_init_test_cases() {
+	atf_add_test_case groupmod_user
+	atf_add_test_case groupmod_invalid_user
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410060016.s960GOWO005239>