+#!/usr/bin/env bats
+
+######################
+# Setup and Teardown #
+######################
+setup () {
+ # Source library
+ local lib_dir="$(dirname $(dirname "$BATS_TEST_FILENAME"))/lib"
+ source "$lib_dir"/users.sh
+
+ # Create user
+ add_user "balto"
+}
+
+teardown () {
+ userdel --remove --force "balto"
+}
+
+###############
+# Begin Tests #
+###############
+@test "users: add_user creates a user with home directory" {
+ # Test user existence and home directory existence
+ run id -u balto
+ [ "$status" -eq 0 ]
+ [ -d "/home/balto" ]
+}
+
+@test "users: add_ssh writes a public key to authorized_keys" {
+ skip "TODO: Use SCP to add key from one machine to the other"
+ local public_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ== test-key"
+
+ # Add SSH key and check files
+ run add_ssh "balto" "$public_key"
+ [ "$status" -eq 0 ]
+ [ -f "/home/balto/.ssh/authorized_keys" ]
+ run grep -q "$public_key" "/home/balto/.ssh/authorized_keys"
+ [ "$status" -eq 0 ]
+}
+
+@test "users: add_user_to_group adds user to specified group" {
+ local group="sudo"
+
+ # Add to group and check
+ run add_user_to_group "balto" "$group"
+ [ "$status" -eq 0 ]
+ run groups "balto"
+ [[ "$output" == *"$group"* ]]
+}
\ No newline at end of file