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

@@ -4,10 +4,9 @@
become: yes
vars:
users:
- username: user
- username: gooduser
password: "$y$j9T$PR8GfM2MjGudOCd7hF9NP1$/qRGtuNuWaRVVGmB1A4rgtaT0MMB9IoB4fnaxW1kvf4" #plop
shell: "/bin/zsh"
public_key:
config:
giturl: "https://git.opytex.org/lafrite/dotfiles.git"
stowing: ["nvim", "tmux", "zsh"]

View File

@@ -3,14 +3,19 @@ dependency:
name: galaxy
driver:
name: vagrant
provider:
name: virtualbox
platforms:
- name: archlinux
box: "archlinux/archlinux"
pre_build_image: true
- name: Debian
box: "debian/bullseye64"
pre_build_image: true
provisioner:
name: ansible
verifier:
name: testinfra
options:
sudo: true
v: 3

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