-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests/services/github/test_branch_manager.py
- Loading branch information
1 parent
4380090
commit 00760ad
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |