Skip to content

Commit

Permalink
test: Testing allow-empty flag for cz commit command
Browse files Browse the repository at this point in the history
  • Loading branch information
Dranaxel committed Sep 18, 2022
1 parent 78fff83 commit a4c9a1e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/commands/test_commit_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ def test_commit_retry_fails_no_backup(config, mocker):
assert NoCommitBackupError.message in str(excinfo.value)


@pytest.mark.usefixtures("staging_is_clean")
def test_commit_allow_empty(config, mocker):
prompt_mock = mocker.patch("questionary.prompt")
prompt_mock.return_value = {
"prefix": "feat",
"subject": "user created",
"scope": "",
"is_breaking_change": False,
"body": "closes #21",
"footer": "",
}

commit_mock = mocker.patch("commitizen.git.commit")
commit_mock.return_value = cmd.Command("success", "", "", "", 0)
success_mock = mocker.patch("commitizen.out.success")

commands.Commit(config, {"allow_empty": True})()
success_mock.assert_called_once()


@pytest.mark.usefixtures("staging_is_clean")
def test_commit_retry_works(config, mocker):
prompt_mock = mocker.patch("questionary.prompt")
Expand Down

0 comments on commit a4c9a1e

Please sign in to comment.