|
9 | 9 |
|
10 | 10 | from commitizen import cmd, commands |
11 | 11 | from commitizen.__version__ import __version__ |
12 | | -from commitizen.cz import registry |
13 | 12 | from commitizen.exceptions import InitFailedError, NoAnswersError |
14 | 13 |
|
15 | 14 | if TYPE_CHECKING: |
@@ -465,20 +464,18 @@ def test_init_configuration_with_version_provider( |
465 | 464 | ) # Version should not be set when using version_provider |
466 | 465 |
|
467 | 466 |
|
468 | | -def test_construct_name_choice_with_description( |
469 | | - config: BaseConfig, mocker: MockFixture |
470 | | -): |
| 467 | +def test_construct_name_choice_from_registry(config: BaseConfig): |
471 | 468 | """Test the construction of cz name choices with descriptions.""" |
472 | | - init = commands.Init(config) |
473 | | - # mock the registry to have only one cz for testing |
474 | | - mocker.patch.dict( |
475 | | - "commitizen.cz.registry", |
476 | | - {"cz_conventional_commits": registry["cz_conventional_commits"]}, |
477 | | - clear=True, |
| 469 | + choices = commands.Init(config)._construct_name_choices_from_registry() |
| 470 | + assert choices[0].title == "cz_conventional_commits" |
| 471 | + assert choices[0].value == "cz_conventional_commits" |
| 472 | + assert choices[0].description == "<type>(<scope>): <subject>" |
| 473 | + assert choices[1].title == "cz_customize" |
| 474 | + assert choices[1].value == "cz_customize" |
| 475 | + assert choices[1].description is None |
| 476 | + assert choices[2].title == "cz_jira" |
| 477 | + assert choices[2].value == "cz_jira" |
| 478 | + assert ( |
| 479 | + choices[2].description |
| 480 | + == "<ignored text> <ISSUE_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>" |
478 | 481 | ) |
479 | | - choices = init._construct_name_choice_with_description() |
480 | | - assert len(choices) == 1 |
481 | | - choice = choices[0] |
482 | | - assert choice.title == "cz_conventional_commits" |
483 | | - assert choice.value == "cz_conventional_commits" |
484 | | - assert choice.description == "<type>(<scope>): <subject>" |
0 commit comments