[purchasing] rename requests -> requested

This commit is contained in:
Mark Spanbroek 2022-03-24 13:48:18 +01:00 committed by markspanbroek
parent 7c9c244836
commit 04c291b05c
2 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@ import pkg/dagger/market
type
MockMarket* = ref object of Market
requests*: seq[StorageRequest]
requested*: seq[StorageRequest]
method requestStorage*(market: MockMarket, request: StorageRequest) {.async.} =
market.requests.add(request)
market.requested.add(request)

View File

@ -23,7 +23,7 @@ suite "Purchasing":
test "submits a storage request when asked":
await purchasing.purchase(request).wait()
let submitted = market.requests[0]
let submitted = market.requested[0]
check submitted.duration == request.duration
check submitted.size == request.size
check submitted.contentHash == request.contentHash
@ -35,12 +35,12 @@ suite "Purchasing":
test "can change default value for proof probability":
purchasing.proofProbability = 42.u256
await purchasing.purchase(request).wait()
check market.requests[0].proofProbability == 42.u256
check market.requested[0].proofProbability == 42.u256
test "can override proof probability per request":
request.proofProbability = 42.u256
await purchasing.purchase(request).wait()
check market.requests[0].proofProbability == 42.u256
check market.requested[0].proofProbability == 42.u256
test "has a default value for request expiration interval":
check purchasing.requestExpiryInterval != 0.u256
@ -49,15 +49,15 @@ suite "Purchasing":
purchasing.requestExpiryInterval = 42.u256
let start = getTime().toUnix()
await purchasing.purchase(request).wait()
check market.requests[0].expiry == (start + 42).u256
check market.requested[0].expiry == (start + 42).u256
test "can override expiry time per request":
let expiry = (getTime().toUnix() + 42).u256
request.expiry = expiry
await purchasing.purchase(request).wait()
check market.requests[0].expiry == expiry
check market.requested[0].expiry == expiry
test "includes a random nonce in every storage request":
await purchasing.purchase(request).wait()
await purchasing.purchase(request).wait()
check market.requests[0].nonce != market.requests[1].nonce
check market.requested[0].nonce != market.requested[1].nonce