diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-19 18:02:55 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-19 19:26:54 +0000 |
commit | be11c93d018a07afd1b166a642f5efa2630474f7 (patch) | |
tree | 9b75c05eef50b23016289e2add261f85493951af /tests | |
parent | 691171323b5b72c9a9d6b59b999c0581301b8d6b (diff) | |
download | alpine-conf-be11c93d018a07afd1b166a642f5efa2630474f7.zip |
setup-user: new setup script
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/setup_user_test | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/setup_user_test b/tests/setup_user_test new file mode 100755 index 0000000..c2c7ce0 --- /dev/null +++ b/tests/setup_user_test @@ -0,0 +1,57 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/test_env.sh +init_tests \ + setup_user_usage \ + setup_user_fullname \ + setup_user_interactive \ + setup_user_interactive_fullname + +setup_user_usage_body() { + test_usage setup-user +} + +setup_user_body() { + init_env + atf_check -s exit:0 \ + -o match:"adduser -D testuser" \ + -e empty \ + setup-user testuser +} + +setup_user_fullname_body() { + init_env + atf_check -s exit:0 \ + -o match:"adduser.* -D .*testuser" \ + -o match:"adduser.* -g Joe User .*testuser" \ + -e empty \ + setup-user -f "Joe User" testuser +} + +setup_user_interactive_body() { + init_env + ( + echo "Joe User" + echo "testuser" + ) | atf_check -s exit:0 \ + -o match:"Enter full name" \ + -o match:"Enter username" \ + -o not-match:"adduser.* -D .*testuser" \ + -o match:"adduser.* -g Joe User .*testuser" \ + -e empty \ + setup-user +} + +setup_user_interactive_fullname_body() { + init_env + ( + echo "testuser" + ) | atf_check -s exit:0 \ + -o not-match:"Enter full name" \ + -o match:"Enter username" \ + -o not-match:"adduser.* -D .*testuser" \ + -o match:"adduser.* -g Joe User .*testuser" \ + -e empty \ + setup-user -f "Joe User" +} + |