mirror of
https://github.com/darksaid98/ubuntu-server-setup.git
synced 2026-12-01 22:22:31 +00:00
36 lines
899 B
Bash
36 lines
899 B
Bash
#!/bin/bash
|
|
|
|
function getCurrentDir() {
|
|
local current_dir="${BASH_SOURCE%/*}"
|
|
if [[ ! -d "${current_dir}" ]]; then current_dir="$PWD"; fi
|
|
echo ${current_dir}
|
|
}
|
|
|
|
current_dir=$(getCurrentDir)
|
|
source "${current_dir}/lib/BashScriptTestingLibrary.shl"
|
|
source "${current_dir}/../setupLibrary.sh"
|
|
|
|
test_user_account=testuser3
|
|
|
|
function testSetup () {
|
|
echo "Test Setup"
|
|
addUserAccount ${test_user_account} "" true
|
|
}
|
|
|
|
function testUserAccountCreated() {
|
|
local user_exists_code=$(id -u ${test_user_account} > /dev/null 2>&1; echo $?)
|
|
assertEquals 0 ${user_exists_code}
|
|
}
|
|
|
|
function testIfUserIsSudo() {
|
|
local user_access=$(sudo -l -U ${test_user_account})
|
|
assertContains "(ALL : ALL) ALL" "${user_access}"
|
|
}
|
|
|
|
function testTeardown () {
|
|
echo "Test Teardown"
|
|
sudo deluser ${test_user_account} sudo
|
|
sudo deluser -f --remove-home ${test_user_account}
|
|
}
|
|
|
|
runUnitTests |