[fix] fix tests
This commit is contained in:
parent
5cb74b6638
commit
2db0131fa4
|
@ -7,7 +7,7 @@ import pkg/codex/storageproofs
|
|||
type
|
||||
MockProofs* = ref object of Proofs
|
||||
periodicity: Periodicity
|
||||
cancelledRequests: HashSet[SlotId]
|
||||
cancelledSlots: HashSet[SlotId]
|
||||
proofsRequired: HashSet[SlotId]
|
||||
proofsToBeRequired: HashSet[SlotId]
|
||||
proofEnds: Table[SlotId, UInt256]
|
||||
|
@ -33,19 +33,15 @@ proc setProofRequired*(mock: MockProofs, id: SlotId, required: bool) =
|
|||
else:
|
||||
mock.proofsRequired.excl(id)
|
||||
|
||||
proc setCancelled*(mock: MockProofs, id: SlotId, required: bool) =
|
||||
proc setSlotCancelled*(mock: MockProofs, id: SlotId, required: bool) =
|
||||
if required:
|
||||
mock.cancelledRequests.incl(id)
|
||||
mock.cancelledSlots.incl(id)
|
||||
else:
|
||||
mock.cancelledRequests.excl(id)
|
||||
|
||||
method isCancelled*(mock: MockProofs,
|
||||
id: RequestId): Future[bool] {.async.} =
|
||||
return mock.cancelledRequests.contains(id)
|
||||
mock.cancelledSlots.excl(id)
|
||||
|
||||
method isSlotCancelled*(mock: MockProofs,
|
||||
id: SlotId): Future[bool] {.async.} =
|
||||
return mock.cancelledRequests.contains(id)
|
||||
return mock.cancelledSlots.contains(id)
|
||||
|
||||
method isProofRequired*(mock: MockProofs,
|
||||
id: SlotId): Future[bool] {.async.} =
|
||||
|
|
|
@ -101,7 +101,7 @@ suite "Proving":
|
|||
proofs.setProofRequired(id, true)
|
||||
await proofs.advanceToNextPeriod()
|
||||
proving.onProofRequired = onProofRequired
|
||||
proofs.setCancelled(id, true)
|
||||
proofs.setSlotCancelled(id, true)
|
||||
await proofs.advanceToNextPeriod()
|
||||
check not proving.slots.contains(id)
|
||||
check not called
|
||||
|
|
Loading…
Reference in New Issue