Feat: testing and multiple fixes

This commit is contained in:
2022-03-04 05:56:37 +01:00
parent 471d39bb86
commit f033b7e59d
8 changed files with 33 additions and 30 deletions

View File

@@ -1,9 +1,9 @@
"""Role testing files using testinfra."""
import pytest
def test_create_users(host):
""" Validate user creation """
user = host.user("user")
user = host.user("gooduser")
assert user.exists
assert user.uid >= 1000
assert user.shell == "/bin/zsh"
@@ -17,7 +17,7 @@ def test_create_users(host):
assert admin.home == f"/home/{admin.name}"
def test_ssh_key(host):
user = host.user("user")
user = host.user("gooduser")
sshdir = host.file(user.home + "/.ssh")
assert not sshdir.exists
@@ -28,7 +28,7 @@ def test_ssh_key(host):
assert autho.contains("user1@fool")
def test_clone_dotfiles(host):
user = host.user("user")
user = host.user("gooduser")
dotfiles = host.file(user.home + "/.dotfiles")
assert dotfiles.exists
assert dotfiles.user == user.name
@@ -39,10 +39,10 @@ def test_clone_dotfiles(host):
assert dotfiles.user == admin.name
def test_stow_config(host):
user = host.user("user")
nvim_config = host.files(user.home + "/.config/nvim/")
user = host.user("gooduser")
nvim_config = host.file(user.home + "/.config/nvim/")
assert nvim_config.exists
admin = host.user("admin")
nvim_config = host.files(admin.home + "/.config/nvim/")
nvim_config = host.file(admin.home + "/.config/nvim/")
assert not nvim_config.exists