diff options
author | bapt <bapt@FreeBSD.org> | 2015-08-02 13:02:53 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-08-02 13:02:53 +0000 |
commit | 8ca0483df0222858a2d49176a4c089e3d4a406d5 (patch) | |
tree | 9fd8540b3b66c65a5119df8a006eca67ad8ba9f3 /usr.sbin/pw | |
parent | 4453f16adb9c5b1a4748ba717d8cb7a673496900 (diff) | |
download | FreeBSD-src-8ca0483df0222858a2d49176a4c089e3d4a406d5.zip FreeBSD-src-8ca0483df0222858a2d49176a4c089e3d4a406d5.tar.gz |
Add regression tests about adding already existsing groups/users
Diffstat (limited to 'usr.sbin/pw')
-rwxr-xr-x | usr.sbin/pw/tests/pw_groupadd.sh | 11 | ||||
-rwxr-xr-x | usr.sbin/pw/tests/pw_useradd.sh | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/usr.sbin/pw/tests/pw_groupadd.sh b/usr.sbin/pw/tests/pw_groupadd.sh index 9c8fdf1..5fa7bef 100755 --- a/usr.sbin/pw/tests/pw_groupadd.sh +++ b/usr.sbin/pw/tests/pw_groupadd.sh @@ -10,6 +10,17 @@ group_add_gid_too_large_body() { ${PW} groupadd -n test1 -g 9999999999999 } +atf_test_case group_add_already_exists +group_add_already_exists_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} groupadd foo + atf_check -s exit:65 \ + -e inline:"pw: group name \`foo' already exists\n" \ + ${PW} groupadd foo +} + atf_init_test_cases() { atf_add_test_case group_add_gid_too_large + atf_add_test_case group_add_already_exists } diff --git a/usr.sbin/pw/tests/pw_useradd.sh b/usr.sbin/pw/tests/pw_useradd.sh index 401769b..f42980d 100755 --- a/usr.sbin/pw/tests/pw_useradd.sh +++ b/usr.sbin/pw/tests/pw_useradd.sh @@ -304,6 +304,16 @@ user_add_bad_shell_body() { atf_check -s exit:78 -e ignore ${PW} useradd bar -s badshell } +atf_test_case user_add_already_exists +user_add_already_exists_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:65 \ + -e inline:"pw: login name \`foo' already exists\n" \ + ${PW} useradd foo +} + atf_init_test_cases() { atf_add_test_case user_add atf_add_test_case user_add_noupdate @@ -330,4 +340,5 @@ atf_init_test_cases() { atf_add_test_case user_add_uid0 atf_add_test_case user_add_uid_too_large atf_add_test_case user_add_bad_shell + atf_add_test_case user_add_already_exists } |