Skip to content

Commit

Permalink
Correct and extend CLI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajron committed Mar 15, 2024
1 parent d559c31 commit e0a5ac1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,27 @@ def test_run_with_other_env(dotenv_path):
assert result == "b\n"


def test_run_without_cmd(cli):
def test_run_without_env(cli):
result = cli.invoke(dotenv_cli, ['run'])

assert result.exit_code == 2
assert "Invalid value for '-f'" in result.output


def test_run_without_cmd(cli):
Path(".env").write_text("")
result = cli.invoke(dotenv_cli, ['run'])

assert result.exit_code == 1
assert "No command given" in result.output


def test_run_with_invalid_cmd(cli):
Path(".env").write_text("")
result = cli.invoke(dotenv_cli, ['run', 'i_do_not_exist'])

assert result.exit_code == 2
assert "Invalid value for '-f'" in result.output
assert result.exit_code == 1
assert isinstance(result.exception, FileNotFoundError)


def test_run_with_version(cli):
Expand Down

0 comments on commit e0a5ac1

Please sign in to comment.