mirror of
https://github.com/darksaid98/ubuntu-server-setup.git
synced 2026-12-02 14:38:58 +00:00
Added functionality to add ssh key
This commit is contained in:
1 parent
003357b848
commit
841312963c
5 files changed
+46
-22
No files matched your search
Submodule
+1
Submodule tests/lib added at e95f7a5c80.
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
Reference in new issue
Block a user