summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_useradd.sh
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2014-12-18 18:46:08 +0000
committerEnji Cooper <ngie@FreeBSD.org>2014-12-18 18:46:08 +0000
commit607004c04d71f6f602fa9b7b10c7aad35620468c (patch)
tree364b59df0e4314ead1751b89af2ac9f5bfb8ca9c /pw/tests/pw_useradd.sh
parentc1e747b63218373477bedc28b65d3765aa9bc550 (diff)
parentd9e43f4c15482b1b306ec63e7ac4d1c78da152ea (diff)
downloadpw-darwin-607004c04d71f6f602fa9b7b10c7aad35620468c.tar.gz
pw-darwin-607004c04d71f6f602fa9b7b10c7aad35620468c.tar.zst
pw-darwin-607004c04d71f6f602fa9b7b10c7aad35620468c.zip
MFhead @ r275911 (also, sort out MK_* flags in BMAKE, etc on this branch)
Diffstat (limited to 'pw/tests/pw_useradd.sh')
-rwxr-xr-xpw/tests/pw_useradd.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh
index fb2e33f..2930c41 100755
--- a/pw/tests/pw_useradd.sh
+++ b/pw/tests/pw_useradd.sh
@@ -13,7 +13,16 @@ user_add_body() {
grep "^test:.*" $HOME/master.passwd
}
+# Test add user with option -N
+atf_test_case user_add_noupdate
+user_add_noupdate_body() {
+ populate_etc_skel
+
+ atf_check -s exit:0 -o match:"^test:.*" ${PW} useradd test -N
+ atf_check -s exit:1 -o empty grep "^test:.*" $HOME/master.passwd
+}
+# Test add user with comments
atf_test_case user_add_comments
user_add_comments_body() {
populate_etc_skel
@@ -23,6 +32,17 @@ user_add_comments_body() {
grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd
}
+# Test add user with comments and option -N
+atf_test_case user_add_comments_noupdate
+user_add_comments_noupdate_body() {
+ populate_etc_skel
+
+ atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \
+ ${PW} useradd test -c "Test User,work,123,456" -N
+ atf_check -s exit:1 -o empty grep "^test:.*" $HOME/master.passwd
+}
+
+# Test add user with invalid comments
atf_test_case user_add_comments_invalid
user_add_comments_invalid_body() {
populate_etc_skel
@@ -33,8 +53,21 @@ user_add_comments_invalid_body() {
grep "^test:.*:Test User,work,123:456,456:" $HOME/master.passwd
}
+# Test add user with invalid comments and option -N
+atf_test_case user_add_comments_invalid_noupdate
+user_add_comments_invalid_noupdate_body() {
+ populate_etc_skel
+
+ atf_check -s exit:65 -e match:"invalid character" \
+ ${PW} useradd test -c "Test User,work,123:456,456" -N
+ atf_check -s exit:1 -o empty grep "^test:.*" $HOME/master.passwd
+}
+
atf_init_test_cases() {
atf_add_test_case user_add
+ atf_add_test_case user_add_noupdate
atf_add_test_case user_add_comments
+ atf_add_test_case user_add_comments_noupdate
atf_add_test_case user_add_comments_invalid
+ atf_add_test_case user_add_comments_invalid_noupdate
}