summaryrefslogtreecommitdiffstats
path: root/pw/tests
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 19:03:41 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 19:03:41 +0000
commitecddcdd12d894cb5522d8c22536d53f1c8cce857 (patch)
tree8e853de567e547095b25456d77f133b74e999930 /pw/tests
parent46d579ce2a5795de6e64374df8158c406039d622 (diff)
downloadpw-darwin-ecddcdd12d894cb5522d8c22536d53f1c8cce857.tar.gz
pw-darwin-ecddcdd12d894cb5522d8c22536d53f1c8cce857.tar.zst
pw-darwin-ecddcdd12d894cb5522d8c22536d53f1c8cce857.zip
Refactor input validation
Mutualize code to validate inputs of both 'user' and 'group' command Test that the input name fits into MAXLOGNAME
Diffstat (limited to 'pw/tests')
-rwxr-xr-xpw/tests/pw_useradd.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/pw/tests/pw_useradd.sh b/pw/tests/pw_useradd.sh
index 48612ed..27a8624 100755
--- a/pw/tests/pw_useradd.sh
+++ b/pw/tests/pw_useradd.sh
@@ -169,12 +169,19 @@ user_add_password_expiration_date_relative_body() {
atf_fail "Expiration time($TIME) was not within $EPOCH - $BUF seconds."
}
+atf_test_case user_add_name_too_long
+user_add_name_too_long_body() {
+ populate_etc_skel
+ atf_check -e match:"too long" -s exit:64 \
+ ${PW} useradd name_very_vert_very_very_very_long
+}
+
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
atf_add_test_case user_add_comments_invalid_noupdate
atf_add_test_case user_add_homedir
atf_add_test_case user_add_account_expiration_epoch
@@ -185,4 +192,5 @@ atf_init_test_cases() {
atf_add_test_case user_add_password_expiration_date_numeric
atf_add_test_case user_add_password_expiration_date_month
atf_add_test_case user_add_password_expiration_date_relative
+ atf_add_test_case user_add_name_too_long
}