Skip to content

Commit

Permalink
Update tests/services/github/test_branch_manager.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gitauto-for-dev[bot] authored Dec 23, 2024
1 parent 4380090 commit 00760ad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/services/github/test_branch_manager.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import unittest
from unittest.mock import patch
from services.github.branch_manager import get_default_branch


class TestBranchManager(unittest.TestCase):

@patch('services.github.branch_manager.requests.get')
def test_get_default_branch(self, mock_get):
mock_response = mock_get.return_value
mock_response.raise_for_status.return_value = None
mock_response.json.return_value = [{
"name": "main",
"commit": {"sha": "abc123"}
}]

default_branch, commit_sha = get_default_branch("owner", "repo", "token")
self.assertEqual(default_branch, "main")
self.assertEqual(commit_sha, "abc123")

if __name__ == '__main__':
unittest.main()

0 comments on commit 00760ad

Please sign in to comment.