Skip to content

Commit ddf79cd

Browse files
committed
Refactor progress
1 parent 5f48690 commit ddf79cd

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

common/tests/test_pool.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pytest
88
from common.pool import Pool
99
from common.block import Block
10-
from common.exceptions import InvalidBlockUUIDError
10+
from common.exceptions import InvalidBlockUUIDError, OutOfPreSharedRandomDataError
1111
from common.utils import bytes_to_str
1212

1313

@@ -120,3 +120,13 @@ def test_allocate_success_empty_pool_two_blocks():
120120
assert allocation is not None
121121
assert allocation.data == bytes.fromhex("0001020304000102")
122122
assert pool.nr_used_bytes == 8
123+
124+
125+
def test_allocate_failure_insufficient_space():
126+
"""
127+
Attempt to allocate an allocation from a pool. There is not enough unused data in the pool.
128+
"""
129+
pool, _blocks = _create_test_pool_and_block([5, 5])
130+
with pytest.raises(OutOfPreSharedRandomDataError):
131+
pool.allocate(20, purpose="test")
132+
assert pool.nr_used_bytes == 0

0 commit comments

Comments
 (0)