File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments