@@ -88,12 +88,14 @@ async def test_check_repo_exists_with_pat() -> None:
8888 mock_process .returncode = 0
8989 mock_exec .return_value = mock_process
9090
91- await check_repo_exists (url , pat )
92-
91+ await _check_repo_exists (url , pat )
92+
9393 # Verify curl command includes authorization header
9494 mock_exec .assert_called_with (
95- "curl" , "-I" ,
96- "-H" , f"Authorization: token { pat } " ,
95+ "curl" ,
96+ "-I" ,
97+ "-H" ,
98+ f"Authorization: token { pat } " ,
9799 url ,
98100 stdout = - 1 , # asyncio.subprocess.PIPE
99101 stderr = - 1 , # asyncio.subprocess.PIPE
@@ -111,12 +113,14 @@ async def test_check_repo_exists_custom_git_server() -> None:
111113 mock_process .returncode = 0
112114 mock_exec .return_value = mock_process
113115
114- await check_repo_exists (url , pat )
115-
116+ await _check_repo_exists (url , pat )
117+
116118 # Verify curl command uses correct API endpoint and includes authorization header
117119 mock_exec .assert_called_with (
118- "curl" , "-I" ,
119- "-H" , f"Authorization: token { pat } " ,
120+ "curl" ,
121+ "-I" ,
122+ "-H" ,
123+ f"Authorization: token { pat } " ,
120124 "https://git.custom.com/api/v1/repos/user/repo" ,
121125 stdout = - 1 , # asyncio.subprocess.PIPE
122126 stderr = - 1 , # asyncio.subprocess.PIPE
@@ -130,22 +134,21 @@ async def test_clone_repo_with_pat() -> None:
130134 local_path = "/tmp/repo" ,
131135 commit = None ,
132136 branch = "main" ,
133- pat = "test_token_123"
137+ pat = "test_token_123" ,
134138 )
135139
136- with patch ("gitingest.clone.check_repo_exists " , return_value = True ) as mock_check :
137- with patch ("gitingest.clone.run_git_command " , new_callable = AsyncMock ) as mock_exec :
140+ with patch ("gitingest.clone._check_repo_exists " , return_value = True ) as mock_check :
141+ with patch ("gitingest.clone._run_git_command " , new_callable = AsyncMock ) as mock_exec :
138142 mock_process = AsyncMock ()
139143 mock_process .communicate .return_value = (b"output" , b"error" )
140144 mock_exec .return_value = mock_process
141145
142146 await clone_repo (clone_config )
143147 mock_check .assert_called_once_with (clone_config .url , clone_config .pat )
144-
148+
145149 # Verify git clone command includes PAT in URL
146150 expected_url = clone_config .url .replace ("https://" , f"https://oauth2:{ clone_config .pat } @" )
147151 # Check that the command was called with the correct arguments
148152 mock_exec .assert_called_with (
149- "git" , "clone" , "--depth=1" , "--single-branch" ,
150- expected_url , clone_config .local_path
153+ "git" , "clone" , "--depth=1" , "--single-branch" , expected_url , clone_config .local_path
151154 )
0 commit comments