Skip to content

Commit 34e7fce

Browse files
committed
Fix: Solve failing test.
1 parent f4b93c3 commit 34e7fce

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/services/test_ipfs_service.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from aleph.services.ipfs.service import IpfsService
8+
from aleph.types.message_status import FileContentUnavailable
89

910

1011
@pytest.mark.asyncio
@@ -178,14 +179,15 @@ async def test_get_ipfs_size_timeout_error():
178179

179180
service = IpfsService(ipfs_client=ipfs_client)
180181

181-
# Mock asyncio.sleep to not actually sleep during test
182-
with patch("asyncio.sleep", new_callable=AsyncMock):
183-
# Execute
184-
result = await service.get_ipfs_size("test_hash")
182+
with pytest.raises(FileContentUnavailable):
183+
# Mock asyncio.sleep to not actually sleep during test
184+
with patch("asyncio.sleep", new_callable=AsyncMock):
185+
# Execute
186+
result = await service.get_ipfs_size("test_hash")
185187

186-
# Assert
187-
assert result is None
188-
ipfs_client.dag.get.assert_called_once_with("test_hash")
188+
# Assert
189+
assert result is None
190+
ipfs_client.dag.get.assert_called_once_with("test_hash")
189191

190192

191193
@pytest.mark.asyncio

0 commit comments

Comments
 (0)