Skip to content

Commit

Permalink
Add: unittest for create_tag cmd function
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalholthaus authored and bjoernricks committed Oct 19, 2022
1 parent 86ffe7f commit f60b266
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/github/test_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from unittest.mock import MagicMock, patch

from pontos.github.api import FileStatus
from pontos.github.cmds import file_status, create_release
from pontos.github.cmds import file_status, create_release, create_tag

here = Path(__file__).parent

Expand Down Expand Up @@ -108,3 +108,26 @@ def test_create_release(self, api_mock):
)

create_release(terminal, args)

@patch("pontos.github.cmds.GitHubRESTApi")
def test_create_tag(self, api_mock):
terminal = MagicMock()
api_mock.return_value.create_tag_reference.return_value = True
api_mock.return_value.create_tag.return_value = True

args = Namespace(
command="TAG",
func=create_tag,
owner="test user",
repo="foo/bar",
tag="test_tag",
name="test_release",
message="test msg",
git_object="commit-sha",
git_object_type=None,
email="[email protected]",
date=None,
token="GITHUB_TOKEN",
)

create_tag(terminal, args)

0 comments on commit f60b266

Please sign in to comment.