2022-01-05 10:25:33 +00:00
|
|
|
"""Role testing files using testinfra."""
|
|
|
|
|
2022-01-10 04:24:47 +00:00
|
|
|
USER1 = "user1"
|
|
|
|
USER2 = "user2"
|
2022-01-05 10:25:33 +00:00
|
|
|
|
|
|
|
def test_stow_installed(host):
|
|
|
|
stow = host.package("stow")
|
|
|
|
assert stow.is_installed
|
|
|
|
|
|
|
|
def test_dotfile_cloned(host):
|
2022-01-10 04:24:47 +00:00
|
|
|
dotfiles = host.file(f"/home/{USER1}/.dotfiles")
|
2022-01-05 10:25:33 +00:00
|
|
|
assert dotfiles.exists
|
2022-01-10 04:24:47 +00:00
|
|
|
assert dotfiles.user == USER1
|
|
|
|
|
|
|
|
dotfiles = host.file(f"/home/{USER2}/.dotfiles")
|
|
|
|
assert dotfiles.exists
|
|
|
|
assert dotfiles.user == USER2
|
2022-01-05 10:25:33 +00:00
|
|
|
|
|
|
|
def test_dotfile_stowed(host):
|
2022-01-10 04:24:47 +00:00
|
|
|
homepath = f"/home/{USER1}"
|
2022-01-05 10:25:33 +00:00
|
|
|
nvim = host.file(homepath + "/.config/nvim/")
|
|
|
|
assert nvim.exists
|
|
|
|
tmux = host.file(homepath + "/.tmux/")
|
|
|
|
assert tmux.exists
|
|
|
|
zshenv = host.file(homepath + "/.zshenv")
|
|
|
|
assert zshenv.exists
|
|
|
|
zsh = host.file(homepath + "/.config/zsh/")
|
|
|
|
assert zsh.exists
|
|
|
|
|
2022-01-10 04:24:47 +00:00
|
|
|
homepath = f"/home/{USER2}"
|
|
|
|
nvim = host.file(homepath + "/.config/nvim/")
|
|
|
|
assert nvim.exists
|
|
|
|
tmux = host.file(homepath + "/.tmux/")
|
|
|
|
assert tmux.exists
|
|
|
|
zshenv = host.file(homepath + "/.zshenv")
|
|
|
|
assert not zshenv.exists
|
|
|
|
zsh = host.file(homepath + "/.config/zsh/")
|
|
|
|
assert not zsh.exists
|
|
|
|
|