Skip to content

Commit

Permalink
tests: add forges tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Nov 15, 2024
1 parent b7fe74c commit 0221c33
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_forges.py
Original file line number Diff line number Diff line change
@@ -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"]
)

0 comments on commit 0221c33

Please sign in to comment.