#!/usr/bin/env atf-sh . $(atf_get_srcdir)/test_env.sh init_tests \ setup_user_usage \ setup_user_fullname \ setup_user_interactive_no \ setup_user_interactive \ setup_user_interactive_fullname \ setup_user_interactive_singlename \ setup_user_interactive_suggest_ssh \ setup_user_groups_commas \ setup_user_groups_spaces \ setup_user_admin 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_no_body() { init_env echo "no" >answers atf_check -s exit:0 \ -o match:"Setup a user" \ -o not-match:"adduser.*" \ -e empty \ setup-user answers atf_check -s exit:0 \ -o match:"Setup a user" \ -o match:"Full name for user testuser" \ -o not-match:"adduser.* -D .*testuser" \ -o match:"adduser.* -g Joe User .*testuser" \ -e empty \ setup-user answers atf_check -s exit:0 \ -o match:"Setup a user.*\[juser\]" \ -o not-match:"Full name for user juser" \ -o not-match:"adduser.* -D .*" \ -o match:"adduser.* -g Joe User .*juser" \ -e empty \ setup-user -f "Joe User" -k none answers atf_check -s exit:0 \ -o match:"Setup a user.*\[joe\]" \ -o not-match:"Full name for user" \ -o not-match:"adduser.* -D .*" \ -o match:"adduser.* -g Joe .*joe" \ -e empty \ setup-user -f "Joe" -k none answers export WGETCONTENT='ssh-id from alpine' atf_check -s exit:0 \ -o match:"Setup a user" \ -o match:"Full name for user" \ -o match:"Enter ssh key.*none" \ -o match:"Enter ssh key.*gitlab.alpinelinux.org.*testuser.keys" \ -o match:"adduser.* -g FullName .*testuser" \ -e empty \ setup-user