Skip to content

Commit

Permalink
Test invalid file
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeShirnia committed Apr 29, 2024
1 parent b542125 commit b8de459
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_validate_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TestSystem:
"dmesg": False,
"quick": False,
"version": None,
"show_all": False
}
)

Expand Down Expand Up @@ -68,3 +69,17 @@ def test_too_many_options(self, capsys):
assert "- File: tests/assets/logs/messages" in out
assert "- Journalctl: True" in out
assert "- Dmesg: True" in out

def test_invalid_file(self, capsys):
# Test invalid file
options = self.values
options.dmesg = False
options.journalctl = False
options.file = "tests/assets/logs/invalid"

with pytest.raises(SystemExit) as ex:
validate_options(self.system, options)
assert ex.code == 1

out, _ = capsys.readouterr()
assert "File tests/assets/logs/invalid does not exist" in out

0 comments on commit b8de459

Please sign in to comment.