From owner-svn-src-all@FreeBSD.ORG Tue Dec 9 20:36:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 878B5AF; Tue, 9 Dec 2014 20:36:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A3A072; Tue, 9 Dec 2014 20:36:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sB9Ka8Sc082746; Tue, 9 Dec 2014 20:36:08 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sB9Ka7dO082744; Tue, 9 Dec 2014 20:36:07 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201412092036.sB9Ka7dO082744@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Tue, 9 Dec 2014 20:36:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275653 - head/usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 20:36:08 -0000 Author: brd (doc committer) Date: Tue Dec 9 20:36:07 2014 New Revision: 275653 URL: https://svnweb.freebsd.org/changeset/base/275653 Log: Add more tests for pw(8) useradd. PR: 195832 Submitted by: Robert O'Neil Approved by: will Added: head/usr.sbin/pw/tests/pw_add.sh (contents, props changed) Modified: head/usr.sbin/pw/tests/Makefile Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Tue Dec 9 20:05:05 2014 (r275652) +++ head/usr.sbin/pw/tests/Makefile Tue Dec 9 20:36:07 2014 (r275653) @@ -5,8 +5,9 @@ TESTSRC= ${.CURDIR}/../../../contrib/net TESTSDIR= ${TESTSBASE}/usr.sbin/pw -ATF_TESTS_SH= pw_delete pw_lock pw_modify pw_etcdir +ATF_TESTS_SH= pw_add pw_delete pw_etcdir pw_lock pw_modify +TEST_METADATA.pw_add+= required_user="root" TEST_METADATA.pw_delete+= required_user="root" TEST_METADATA.pw_modify+= required_user="root" Added: head/usr.sbin/pw/tests/pw_add.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_add.sh Tue Dec 9 20:36:07 2014 (r275653) @@ -0,0 +1,40 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test add user +atf_test_case user_add +user_add_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test + atf_check -s exit:0 -o match:"^test:.*" \ + grep "^test:.*" $HOME/master.passwd +} + + +atf_test_case user_add_comments +user_add_comments_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456" + atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ + grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd +} + +atf_test_case user_add_comments_invalid +user_add_comments_invalid_body() { + populate_etc_skel + + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd test -c "Test User,work,123:456,456" + atf_check -s exit:1 -o empty \ + grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd +} + +atf_init_test_cases() { + atf_add_test_case user_add + atf_add_test_case user_add_comments + atf_add_test_case user_add_comments_invalid +}