summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_useradd.sh
diff options
context:
space:
mode:
authorBrad Davis <brd@FreeBSD.org>2014-12-09 21:43:03 +0000
committerBrad Davis <brd@FreeBSD.org>2014-12-09 21:43:03 +0000
commit0a90b89c483dd20bd105cbbd9effc194c132d940 (patch)
tree0e1aa276c4d8f25c2d73e06d0d22e19d749a83d3 /pw/tests/pw_useradd.sh
parentc3f6155386bf3365788c093a31a818fbc3af8e6a (diff)
downloadpw-darwin-0a90b89c483dd20bd105cbbd9effc194c132d940.tar.gz
pw-darwin-0a90b89c483dd20bd105cbbd9effc194c132d940.tar.zst
pw-darwin-0a90b89c483dd20bd105cbbd9effc194c132d940.zip
Break out the tests into a file per command and clean up some long lines
Approved by: will
Diffstat (limited to 'pw/tests/pw_useradd.sh')
-rwxr-xr-xpw/tests/pw_useradd.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh
new file mode 100755
index 0000000..fb2e33f
--- /dev/null
+++ b/pw/tests/pw_useradd.sh
@@ -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
+}