Skip to content

Commit cb8b203

Browse files
committed
Fix check_repo_exists test
1 parent fe45dbb commit cb8b203

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/gitingest/tests/test_clone.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,18 @@ async def test_check_repo_exists():
6060

6161
with patch('asyncio.create_subprocess_exec', new_callable=AsyncMock) as mock_exec:
6262
mock_process = AsyncMock()
63+
mock_process.communicate.return_value = (b'HTTP/1.1 200 OK\n', b'')
64+
mock_exec.return_value = mock_process
6365

6466
# Test existing repository
6567
mock_process.returncode = 0
66-
mock_exec.return_value = mock_process
6768
assert await check_repo_exists(url) is True
6869

69-
# Test non-existing repository
70+
# Test non-existing repository (404 response)
71+
mock_process.communicate.return_value = (b'HTTP/1.1 404 Not Found\n', b'')
72+
mock_process.returncode = 0
73+
assert await check_repo_exists(url) is False
74+
75+
# Test failed request
7076
mock_process.returncode = 1
71-
mock_exec.return_value = mock_process
7277
assert await check_repo_exists(url) is False

0 commit comments

Comments
 (0)