def test_markdown_changelog_gitlab(): with mock.patch( "semantic_release.changelog.config.get", wrapped_config_get(hvcs="gitlab") ): assert markdown_changelog( "owner", "repo_name", "0", { "refactor": [("12", "Refactor super-feature")], "feature": [ ("145", "Add non-breaking super-feature (#1)"), ("134", "Add super-feature"), ], "documentation": [("0", "Document super-feature (#189)")], "performance": [], }, ) == ( # Expected output with the default configuration "### Feature\n" "* Add non-breaking super-feature ([#1](https://gitlab.com/owner/" "repo_name/-/merge_requests/1)) ([`145`](https://gitlab.com/owner/" "repo_name/-/commit/145))\n" "* Add super-feature ([`134`](https://gitlab.com/owner/repo_name/-/" "commit/134))\n" "\n" "### Documentation\n" "* Document super-feature ([#189](https://gitlab.com/owner/repo_name/" "-/merge_requests/189)) ([`0`](https://gitlab.com/owner/repo_name/" "-/commit/0))" )
def test_should_not_output_heading(): assert "v1.0.1" not in markdown_changelog( "owner", "repo_name", "1.0.1", {}, )
def test_markdown_changelog(): assert markdown_changelog( "owner", "repo_name", "0", { "refactor": [("12", "Refactor super-feature")], "breaking": [("21", "Uses super-feature as default instead of dull-feature.")], "feature": [ ("145", "Add non-breaking super-feature"), ("134", "Add super-feature"), ], "fix": [("234", "Fix bug in super-feature")], "documentation": [("0", "Document super-feature")], "performance": [], }, ) == ( # Expected output with the default configuration "### Feature\n" "* Add non-breaking super-feature ([`145`](https://github.com/owner/repo_name/" "commit/145))\n" "* Add super-feature ([`134`](https://github.com/owner/repo_name/commit/134))\n" "\n" "### Fix\n" "* Fix bug in super-feature ([`234`](https://github.com/owner/repo_name/" "commit/234))\n" "\n" "### Breaking\n" "* Uses super-feature as default instead of dull-feature." " ([`21`](https://github.com/owner/repo_name/commit/21))\n" "\n" "### Documentation\n" "* Document super-feature ([`0`](https://github.com/owner/repo_name/commit/0))" )
def test_markdown_changelog(): assert markdown_changelog( "0", { "refactor": [("12", "Refactor super-feature")], "breaking": [("21", "Uses super-feature as default instead of dull-feature.")], "feature": [ ("145", "Add non-breaking super-feature"), ("134", "Add super-feature"), ], "fix": [("234", "Fix bug in super-feature")], "documentation": [("0", "Document super-feature")], "performance": [], }, ) == ( # Expected output with the default configuration "### Feature\n" "* Add non-breaking super-feature (145)\n" "* Add super-feature (134)\n" "\n" "### Fix\n" "* Fix bug in super-feature (234)\n" "\n" "### Breaking\n" "* Uses super-feature as default instead of dull-feature. (21)\n" "\n" "### Documentation\n" "* Document super-feature (0)")
def test_should_output_heading(): assert "## v1.0.1\n" in markdown_changelog( "owner", "repo_name", "1.0.1", {}, header=True, )
def test_should_not_output_heading(): assert "v1.0.1" not in markdown_changelog( "1.0.1", {}, )