- Add some tests for modifying groups
Reviewed by: will
This commit is contained in:
parent
064291755a
commit
4630309ca3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272578
@ -2,7 +2,7 @@
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/usr.sbin/pw
|
||||
|
||||
ATF_TESTS_SH= pw_delete
|
||||
ATF_TESTS_SH= pw_delete pw_modify
|
||||
|
||||
FILES= group helper_functions.shin master.passwd
|
||||
FILESDIR= ${TESTSDIR}
|
||||
|
34
usr.sbin/pw/tests/pw_modify.sh
Executable file
34
usr.sbin/pw/tests/pw_modify.sh
Executable file
@ -0,0 +1,34 @@
|
||||
# $FreeBSD$
|
||||
|
||||
# Import helper functions
|
||||
. $(atf_get_srcdir)/helper_functions.shin
|
||||
|
||||
|
||||
# Test adding & removing a user from a group
|
||||
atf_test_case groupmod_user
|
||||
groupmod_user_body() {
|
||||
populate_etc_skel
|
||||
atf_check -s exit:0 pw -V ${HOME} addgroup test
|
||||
atf_check -s exit:0 pw -V ${HOME} groupmod test -m root
|
||||
atf_check -s exit:0 -o match:"^test:\*:1001:root$" \
|
||||
grep "^test:\*:.*:root$" $HOME/group
|
||||
atf_check -s exit:0 pw -V ${HOME} groupmod test -d root
|
||||
atf_check -s exit:0 -o match:"^test:\*:1001:$" \
|
||||
grep "^test:\*:.*:$" $HOME/group
|
||||
}
|
||||
|
||||
|
||||
# Test adding and removing a user that does not exist
|
||||
atf_test_case groupmod_invalid_user
|
||||
groupmod_invalid_user_body() {
|
||||
populate_etc_skel
|
||||
atf_check -s exit:0 pw -V ${HOME} addgroup test
|
||||
atf_check -s exit:67 -e match:"does not exist" pw -V ${HOME} groupmod test -m foo
|
||||
atf_check -s exit:0 pw -V ${HOME} groupmod test -d foo
|
||||
}
|
||||
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case groupmod_user
|
||||
atf_add_test_case groupmod_invalid_user
|
||||
}
|
Loading…
Reference in New Issue
Block a user