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