From 0221c330a7b70070c70831d6aef19794d95a77eb Mon Sep 17 00:00:00 2001 From: Adrien Carpentier Date: Thu, 14 Nov 2024 18:37:51 +0100 Subject: [PATCH] tests: add forges tests --- tests/test_forges.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_forges.py diff --git a/tests/test_forges.py b/tests/test_forges.py new file mode 100644 index 0000000..caf6f09 --- /dev/null +++ b/tests/test_forges.py @@ -0,0 +1,33 @@ +from bumpx.forge import BaseForge, GitHub + + +class BaseForgeTest: + def test_execute_verbose(self, mocker): + forge = BaseForge(verbose=True) + execute = mocker.patch("bumpx.forge.execute") + forge.execute("cmd arg") + execute.assert_called_with("cmd arg", verbose=True) + + def test_execute_quiet(self, mocker): + forge = BaseForge(verbose=False) + execute = mocker.patch("bumpx.forge.execute") + forge.execute("cmd arg") + execute.assert_called_with("cmd arg", verbose=False) + + +class GitHubTest: + def test_release(self, mocker): + github = GitHub() + + execute = mocker.patch.object(github, "execute") + github.release(version="fake") + execute.assert_called_with(["gh", "release", "create", "fake", "--title", "fake"]) + + def test_release_with_notes(self, mocker): + github = GitHub() + + execute = mocker.patch.object(github, "execute") + github.release(version="fake", notes="some notes") + execute.assert_called_with( + ["gh", "release", "create", "fake", "--title", "fake", "--notes", "some notes"] + )