mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix: Fix get_current_git_branch test
- Use `InvalidGitRepositoryError` instead of generic `Exception` in `test_get_current_git_branch_failure` to accurately simulate a failure scenario.
This commit is contained in:
@@ -3,6 +3,7 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
from git import InvalidGitRepositoryError
|
||||
|
||||
from autogpt.app.utils import (
|
||||
get_bulletin_from_web,
|
||||
@@ -186,7 +187,7 @@ def test_get_current_git_branch_success(mock_repo):
|
||||
|
||||
@patch("autogpt.app.utils.Repo")
|
||||
def test_get_current_git_branch_failure(mock_repo):
|
||||
mock_repo.side_effect = Exception()
|
||||
mock_repo.side_effect = InvalidGitRepositoryError()
|
||||
branch_name = get_current_git_branch()
|
||||
|
||||
assert branch_name == ""
|
||||
|
||||
Reference in New Issue
Block a user