diff options
| author | Enji Cooper <ngie@FreeBSD.org> | 2017-05-28 02:15:57 +0000 |
|---|---|---|
| committer | Enji Cooper <ngie@FreeBSD.org> | 2017-05-28 02:15:57 +0000 |
| commit | cc6a6ed4749dd4cc06857b7239a8dbb8098e4461 (patch) | |
| tree | 988d8b6c6f09f9320d18cc462f2f8d499c8f869e /pw/tests/pw_groupshow_test.sh | |
| parent | f03b79738ca650b944ae041581b20008076d436c (diff) | |
| download | pw-darwin-cc6a6ed4749dd4cc06857b7239a8dbb8098e4461.tar.gz pw-darwin-cc6a6ed4749dd4cc06857b7239a8dbb8098e4461.zip | |
pw: add some basic testcases for groupshow and usershow
- groupshow: test out -a/-g/-n .
- usershow: test out -a/-n/-u .
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Diffstat (limited to 'pw/tests/pw_groupshow_test.sh')
| -rwxr-xr-x | pw/tests/pw_groupshow_test.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pw/tests/pw_groupshow_test.sh b/pw/tests/pw_groupshow_test.sh new file mode 100755 index 0000000..f348d0a --- /dev/null +++ b/pw/tests/pw_groupshow_test.sh @@ -0,0 +1,56 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +atf_test_case group_show_all +group_show_all_body() { + populate_etc_skel + atf_check -o not-empty ${PW} groupshow -a +} + +atf_test_case group_show_gid +group_show_gid_body() { + populate_etc_skel + atf_check -o not-empty ${PW} groupshow -g 0 +} + +atf_test_case group_show_name +group_show_name_body() { + populate_etc_skel + atf_check -o not-empty ${PW} groupshow wheel +} + +atf_test_case group_show_nonexistent_gid +group_show_nonexistent_gid_body() { + populate_etc_skel + + nonexistent_gid=4242 + no_such_name_msg="pw: unknown gid \`$nonexistent_gid'\n" + + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + $nonexistent_gid + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + -g $nonexistent_gid +} + +atf_test_case group_show_nonexistent_name +group_show_nonexistent_name_body() { + populate_etc_skel + + nonexistent_name=bogus + no_such_name_msg="pw: unknown group \`$nonexistent_name'\n" + + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + $nonexistent_name + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + -n $nonexistent_name +} + +atf_init_test_cases() { + atf_add_test_case group_show_all + atf_add_test_case group_show_gid + atf_add_test_case group_show_name + atf_add_test_case group_show_nonexistent_gid + atf_add_test_case group_show_nonexistent_name +} |
