pw_groupmod.sh revision 272578
1# $FreeBSD: head/usr.sbin/pw/tests/pw_modify.sh 272578 2014-10-06 00:16:23Z brd $ 2 3# Import helper functions 4. $(atf_get_srcdir)/helper_functions.shin 5 6 7# Test adding & removing a user from a group 8atf_test_case groupmod_user 9groupmod_user_body() { 10 populate_etc_skel 11 atf_check -s exit:0 pw -V ${HOME} addgroup test 12 atf_check -s exit:0 pw -V ${HOME} groupmod test -m root 13 atf_check -s exit:0 -o match:"^test:\*:1001:root$" \ 14 grep "^test:\*:.*:root$" $HOME/group 15 atf_check -s exit:0 pw -V ${HOME} groupmod test -d root 16 atf_check -s exit:0 -o match:"^test:\*:1001:$" \ 17 grep "^test:\*:.*:$" $HOME/group 18} 19 20 21# Test adding and removing a user that does not exist 22atf_test_case groupmod_invalid_user 23groupmod_invalid_user_body() { 24 populate_etc_skel 25 atf_check -s exit:0 pw -V ${HOME} addgroup test 26 atf_check -s exit:67 -e match:"does not exist" pw -V ${HOME} groupmod test -m foo 27 atf_check -s exit:0 pw -V ${HOME} groupmod test -d foo 28} 29 30 31atf_init_test_cases() { 32 atf_add_test_case groupmod_user 33 atf_add_test_case groupmod_invalid_user 34} 35