Add regression tests about adding already existsing groups/users

This commit is contained in:
Baptiste Daroussin 2015-08-02 13:02:53 +00:00
parent f4124312a1
commit b8a5086ef0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286200
2 changed files with 22 additions and 0 deletions

View File

@ -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
}

View File

@ -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
}