File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,3 +196,20 @@ def test_from_enc_str_bad_no_fragments():
196196 pool , _blocks = create_test_pool_and_blocks ([10 ])
197197 with pytest .raises (InvalidEncodedFragment ):
198198 _allocation = Allocation .from_enc_str ("" , pool )
199+
200+
201+ def test_from_enc_str_bad_fragment ():
202+ """
203+ Attempt to create an Allocation from a bad APIAllocation: one of the fragments has an invalid
204+ block UUID.
205+ """
206+ pool , blocks = create_test_pool_and_blocks ([10 ])
207+ # Bad block UUID
208+ with pytest .raises (InvalidBlockUUIDError ):
209+ _allocation = Allocation .from_enc_str (f"not-a-uuid:0:5" , pool )
210+ # Bad start index
211+ with pytest .raises (InvalidPSRDIndex ):
212+ _allocation = Allocation .from_enc_str (f"{ blocks [0 ].uuid } :20:5" , pool )
213+ # Bad size
214+ with pytest .raises (InvalidPSRDIndex ):
215+ _allocation = Allocation .from_enc_str (f"{ blocks [0 ].uuid } :3:99999" , pool )
You can’t perform that action at this time.
0 commit comments