From f71af095437d3ed6d9a5974c114a694360fe0bee Mon Sep 17 00:00:00 2001 From: "gitauto-ai[bot]" <161652217+gitauto-ai[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 00:08:21 +0000 Subject: [PATCH] Update tests/services/github/test_branch_manager.py --- tests/services/github/test_branch_manager.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/services/github/test_branch_manager.py b/tests/services/github/test_branch_manager.py index 1421eace..842c9627 100644 --- a/tests/services/github/test_branch_manager.py +++ b/tests/services/github/test_branch_manager.py @@ -27,3 +27,17 @@ def test_get_default_branch(mock_get): }, timeout=TIMEOUT, ) + + +@patch("requests.get") +def test_get_default_branch_http_error(mock_get): + # Mock an HTTP error response + mock_get.return_value.status_code = 404 + mock_get.return_value.json.return_value = {"message": "Not Found"} + + # Call the function and assert it raises an HTTPException + try: + get_default_branch(OWNER, REPO, TOKEN) + except Exception as e: + assert isinstance(e, Exception) + assert str(e) == "HTTP Error: 404 - Not Found"