summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_useradd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pw/tests/pw_useradd.sh')
-rwxr-xr-xpw/tests/pw_useradd.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh
index d059828..32d3b9d 100755
--- a/pw/tests/pw_useradd.sh
+++ b/pw/tests/pw_useradd.sh
@@ -207,6 +207,30 @@ user_add_expiration_body() {
atf_check -s exit:0 ${PW} userdel foo
}
+atf_test_case user_add_invalid_user_entry
+user_add_invalid_user_entry_body() {
+ touch ${HOME}/master.passwd
+ touch ${HOME}/group
+
+ pwd_mkdb -p -d ${HOME} ${HOME}/master.passwd || \
+ atf_fail "generate passwd from master.passwd"
+ atf_check -s exit:0 ${PW} useradd foo
+ echo "foo1:*:1002" >> ${HOME}/master.passwd
+ atf_check -s exit:1 -e match:"Invalid user entry" ${PW} useradd foo2
+}
+
+atf_test_case user_add_invalid_group_entry
+user_add_invalid_group_entry_body() {
+ touch ${HOME}/master.passwd
+ touch ${HOME}/group
+
+ pwd_mkdb -p -d ${HOME} ${HOME}/master.passwd || \
+ atf_fail "generate passwd from master.passwd"
+ atf_check -s exit:0 ${PW} useradd foo
+ echo 'foo1:*:1002' >> group
+ atf_check -s exit:1 -e match:"Invalid group entry" ${PW} useradd foo2
+}
+
atf_init_test_cases() {
atf_add_test_case user_add
atf_add_test_case user_add_noupdate
@@ -225,4 +249,6 @@ atf_init_test_cases() {
atf_add_test_case user_add_password_expiration_date_relative
atf_add_test_case user_add_name_too_long
atf_add_test_case user_add_expiration
+ atf_add_test_case user_add_invalid_user_entry
+ atf_add_test_case user_add_invalid_group_entry
}