Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 345
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
b0682d578fff83a4c9a1e6493ff34f9c725File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -52,6 +52,28 @@ 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") | ||
Member 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 Author 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 ? Member 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})() | ||
| commit_mock.assert_called_with("feat: user created\n\ncloses #21", "--allow-empty") | ||
| 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.