-
-
Notifications
You must be signed in to change notification settings - Fork 281
Feature/allow empty commit #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
b0682d5
78fff83
a4c9a1e
6493ff3
4f9c725
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Dranaxel Thanks for correcting me. Yes, you're right. In that case, we probably should assert whether this function is called with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry i'm not sure about what you mean/how to use assert_called_with. Are you suggesting to assert the flag allow-empty was here when le command was launched ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assert |
||
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") | ||
|
Uh oh!
There was an error while loading. Please reload this page.