xref: /freebsd/usr.sbin/pw/tests/pw_groupdel_test.sh (revision 95eb4b873b6a8b527c5bd78d7191975dfca38998)
1
2# Import helper functions
3. $(atf_get_srcdir)/helper_functions.shin
4
5
6# Test to make sure we do not accidentially delete wheel when trying to delete
7# an unknown group
8atf_test_case group_do_not_delete_wheel_if_group_unknown
9group_do_not_delete_wheel_if_group_unknown_head() {
10        atf_set "descr" "Make sure we do not consider gid 0 an unknown group"
11}
12group_do_not_delete_wheel_if_group_unknown_body() {
13        populate_etc_skel
14        atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel
15        atf_check -e inline:"pw: Bad id 'I_do_not_exist': invalid\n" -s exit:64 -x \
16		${PW} groupdel -g I_do_not_exist
17        atf_check -s exit:0 -o inline:"wheel:*:0:root\n" -x ${PW} groupshow wheel
18}
19
20
21atf_init_test_cases() {
22        atf_add_test_case group_do_not_delete_wheel_if_group_unknown
23}
24