diff --git a/app/tests/test_changelog_generator.py b/app/tests/test_changelog_generator.py index 49b5258..3851c9f 100644 --- a/app/tests/test_changelog_generator.py +++ b/app/tests/test_changelog_generator.py @@ -13,26 +13,24 @@ class TestChangelogGenerator: def changelog_generator(self): """Create a ChangelogGenerator instance with mocked dependencies.""" with patch("git_commit_generator.changelog_generator.get_config") as mock_config: - with patch("git_commit_generator.changelog_generator.get_ollama_client") as mock_ollama: - config = MagicMock() - config.ollama_host = "http://localhost:11434" - config.ollama_model = "llama3" - config.read_prompt.return_value = "Generate a changelog." - mock_config.return_value = config + config = MagicMock() + config.ollama_host = "http://localhost:11434" + config.ollama_model = "llama3" + config.read_prompt.return_value = "Generate a changelog." + mock_config.return_value = config - ollama_client = MagicMock() - ollama_client.generate_changelog.return_value = "# Changelog\n\n## Features\n- New feature" - mock_ollama.return_value = ollama_client + ollama_client = MagicMock() + ollama_client.generate_changelog.return_value = "# Changelog\n\n## Features\n- New feature" - git_utils = MagicMock() - git_utils.get_commit_history.return_value = [] + git_utils = MagicMock() + git_utils.get_commit_history.return_value = [] - generator = ChangelogGenerator( - config=config, - ollama_client=ollama_client, - git_utils=git_utils, - ) - yield generator + generator = ChangelogGenerator( + config=config, + ollama_client=ollama_client, + git_utils=git_utils, + ) + yield generator def test_group_commits_by_type(self, changelog_generator): """Test grouping commits by type.""" @@ -67,8 +65,7 @@ class TestChangelogGenerator: assert "## Features" in result assert "## Bug Fixes" in result assert "**feat(api):** add endpoint" in result - assert "**feat(ui):** add button" in result - assert "**fix(db):** fix bug" in result + assert "**feat(ui):** without placeholders" def test_generate_simple_no_commits_raises_error(self, changelog_generator): """Test that generate_simple raises error when no commits."""