Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
royreznik committed Feb 9, 2024
1 parent 986c702 commit 20fdc50
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ def test_file_input(monkeypatch: MonkeyPatch, tmp_path: Path) -> None:

def test_initial_pattern(monkeypatch: MonkeyPatch, tmp_path: Path) -> None:
runner = CliRunner()
text = "This iS! aTe xt2 F0r T3sT!ng"
(tmp_path / "text_file").write_text(text)
class_mock = Mock()
instance_mock = Mock()
with monkeypatch.context():
class_mock.return_value = instance_mock
monkeypatch.setattr("rexi.cli.RexiApp", class_mock)
result = runner.invoke(app, input="", args=["-p", "(wtf)"])
print(result.output)
class_mock.assert_called_once_with("", initial_pattern="(wtf)")
runner.invoke(app, args=["-i", str(tmp_path / "text_file"), "--pattern", "wtf"])
class_mock.assert_called_once_with(text, initial_pattern="wtf")

0 comments on commit 20fdc50

Please sign in to comment.