diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-10-28 11:58:18 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-10-28 11:58:18 +0000 |
commit | 31821e10331e5275bfb2b572454feb58c607bef1 (patch) | |
tree | 71dcb7f2f3f7fcea3ca751ce739655296f9c59f2 /pw/tests/pw_usermod.sh | |
parent | f1bef959a51e2994216735586c6ef525f2728f10 (diff) | |
parent | 09acfb95717de6c2b93a0d318be244723fde1fe0 (diff) | |
download | pw-darwin-31821e10331e5275bfb2b572454feb58c607bef1.tar.gz pw-darwin-31821e10331e5275bfb2b572454feb58c607bef1.tar.zst pw-darwin-31821e10331e5275bfb2b572454feb58c607bef1.zip |
Merge from head
Sponsored by: Gandi.net
Diffstat (limited to 'pw/tests/pw_usermod.sh')
-rwxr-xr-x | pw/tests/pw_usermod.sh | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/pw/tests/pw_usermod.sh b/pw/tests/pw_usermod.sh index 006bb2c..236fd27 100755 --- a/pw/tests/pw_usermod.sh +++ b/pw/tests/pw_usermod.sh @@ -100,6 +100,36 @@ user_mod_name_noupdate_body() { grep "^foo:.*" $HOME/master.passwd } +atf_test_case user_mod_rename_multigroups +user_mod_rename_multigroups_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} groupadd test1 + atf_check -s exit:0 ${PW} groupadd test2 + atf_check -s exit:0 ${PW} useradd foo -G test1,test2 + atf_check -o match:"foo" -s exit:0 ${PW} groupshow test1 + atf_check -o match:"foo" -s exit:0 ${PW} groupshow test2 + atf_check -s exit:0 ${PW} usermod foo -l bar + atf_check -o match:"bar" -s exit:0 ${PW} groupshow test1 + atf_check -o match:"bar" -s exit:0 ${PW} groupshow test2 +} + +atf_test_case user_mod_nogroups +user_mod_nogroups_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} groupadd test1 + atf_check -s exit:0 ${PW} groupadd test2 + atf_check -s exit:0 ${PW} groupadd test3 + atf_check -s exit:0 ${PW} groupadd test4 + atf_check -s exit:0 ${PW} useradd foo -G test1,test2 + atf_check -o match:"foo" -s exit:0 ${PW} groupshow test1 + atf_check -o match:"foo" -s exit:0 ${PW} groupshow test2 + atf_check -s exit:0 ${PW} usermod foo -G test3,test4 + atf_check -s exit:0 -o inline:"test3\ntest4\n" \ + awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group +} + atf_test_case user_mod_rename user_mod_rename_body() { populate_etc_skel @@ -134,7 +164,7 @@ user_mod_h_body() { EOF atf_check -s exit:0 -o match:"^foo:\*:.*" \ grep "^foo" ${HOME}/master.passwd - atf_check -e inline:"pw: '-h' expects a file descriptor or '-'\n" \ + atf_check -e inline:"pw: Bad file descriptor 'a': invalid\n" \ -s exit:64 ${PW} usermod foo -h a <<- EOF $(echo a) EOF @@ -150,10 +180,29 @@ user_mod_H_body() { EOF atf_check -s exit:0 -o match:"^foo:a:.*" \ grep "^foo" ${HOME}/master.passwd - atf_check -s exit:64 -e inline:"pw: '-H' expects a file descriptor\n" \ + atf_check -s exit:64 -e inline:"pw: -H expects a file descriptor\n" \ ${PW} usermod foo -H - } +atf_test_case user_mod_renamehome +user_mod_renamehome_body() { + populate_root_etc_skel + + mkdir -p ${HOME}/home + atf_check -s exit:0 ${RPW} useradd foo -m + test -d ${HOME}/home/foo || atf_fail "Directory not created" + atf_check -s exit:0 ${RPW} usermod foo -l bar -d /home/bar -m + test -d ${HOME}/home/bar || atf_fail "Directory not created" +} + +atf_test_case user_mod_uid +user_mod_uid_body() { + populate_etc_skel + + atf_check -s exit:0 ${PW} useradd foo + atf_check -s exit:0 ${PW} usermod foo -u 5000 +} + atf_init_test_cases() { atf_add_test_case user_mod atf_add_test_case user_mod_noupdate @@ -161,10 +210,13 @@ atf_init_test_cases() { atf_add_test_case user_mod_comments_noupdate atf_add_test_case user_mod_comments_invalid atf_add_test_case user_mod_comments_invalid_noupdate + atf_add_test_case user_mod_nogroups atf_add_test_case user_mod_rename atf_add_test_case user_mod_name_noupdate - atf_add_test_case user_mod_rename atf_add_test_case user_mod_rename_too_long + atf_add_test_case user_mod_rename_multigroups atf_add_test_case user_mod_h atf_add_test_case user_mod_H + atf_add_test_case user_mod_renamehome + atf_add_test_case user_mod_uid } |