Skip to content

Commit

Permalink
adding additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samypr100 committed Jun 12, 2023
1 parent 275ff17 commit a801b74
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/console/commands/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,39 @@ def test_check_private(
assert tester.io.fetch_output() == expected


@pytest.mark.parametrize(
("options", "expected", "expected_status"),
[
("", "All set!\n", 0),
("--lock", "Error: poetry.lock was not found.\n", 1),
],
)
def test_check_lock_missing(
mocker: MockerFixture,
tester: CommandTester,
fixture_dir: FixtureDirGetter,
options: str,
expected: str,
expected_status: int,
) -> None:
from poetry.toml import TOMLFile

mocker.patch(
"poetry.poetry.Poetry.file",
return_value=TOMLFile(fixture_dir("private_pyproject") / "pyproject.toml"),
new_callable=mocker.PropertyMock,
)

status_code = tester.execute(options)

assert status_code == expected_status

if status_code == 0:
assert tester.io.fetch_output() == expected
else:
assert tester.io.fetch_error() == expected


@pytest.mark.parametrize("options", ["", "--lock"])
def test_check_lock_outdated(
command_tester_factory: CommandTesterFactory,
Expand Down

0 comments on commit a801b74

Please sign in to comment.