|
@ -122,7 +122,7 @@ func TestGetSlots(t *testing.T) { |
|
|
// All slots with maxSlotNum filter
|
|
|
// All slots with maxSlotNum filter
|
|
|
maxSlotNum := tc.slots[len(tc.slots)-1].SlotNum + 5 |
|
|
maxSlotNum := tc.slots[len(tc.slots)-1].SlotNum + 5 |
|
|
limit := 1 |
|
|
limit := 1 |
|
|
path := fmt.Sprintf("%s?maxSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, limit) |
|
|
|
|
|
|
|
|
path := fmt.Sprintf("%s?maxSlotNum=%d&limit=%d", endpoint, maxSlotNum, limit) |
|
|
err := doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
err := doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
allSlots := tc.slots |
|
|
allSlots := tc.slots |
|
@ -135,7 +135,7 @@ func TestGetSlots(t *testing.T) { |
|
|
// All slots with maxSlotNum filter, in reverse order
|
|
|
// All slots with maxSlotNum filter, in reverse order
|
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
limit = 3 |
|
|
limit = 3 |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&limit=%d", endpoint, maxSlotNum, limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderDesc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderDesc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
|
|
|
|
|
@ -149,7 +149,7 @@ func TestGetSlots(t *testing.T) { |
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
limit = 1 |
|
|
limit = 1 |
|
|
bidderAddr := tc.coordinators[2].Bidder |
|
|
bidderAddr := tc.coordinators[2].Bidder |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&wonByEthereumAddress=%s&limit=%d&fromItem=", endpoint, maxSlotNum, bidderAddr.String(), limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&wonByEthereumAddress=%s&limit=%d", endpoint, maxSlotNum, bidderAddr.String(), limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
bidderAddressSlots := []testSlot{} |
|
|
bidderAddressSlots := []testSlot{} |
|
@ -165,7 +165,7 @@ func TestGetSlots(t *testing.T) { |
|
|
// maxSlotNum & wonByEthereumAddress, in reverse order
|
|
|
// maxSlotNum & wonByEthereumAddress, in reverse order
|
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
limit = 1 |
|
|
limit = 1 |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&wonByEthereumAddress=%s&limit=%d&fromItem=", endpoint, maxSlotNum, bidderAddr.String(), limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&wonByEthereumAddress=%s&limit=%d", endpoint, maxSlotNum, bidderAddr.String(), limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderDesc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderDesc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
flippedBidderAddressSlots := []testSlot{} |
|
|
flippedBidderAddressSlots := []testSlot{} |
|
@ -177,7 +177,7 @@ func TestGetSlots(t *testing.T) { |
|
|
// finishedAuction
|
|
|
// finishedAuction
|
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
limit = 15 |
|
|
limit = 15 |
|
|
path = fmt.Sprintf("%s?finishedAuction=%t&limit=%d&fromItem=", endpoint, true, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?finishedAuction=%t&limit=%d", endpoint, true, limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
|
|
|
|
|
@ -198,7 +198,7 @@ func TestGetSlots(t *testing.T) { |
|
|
minSlotNum := tc.slots[3].SlotNum |
|
|
minSlotNum := tc.slots[3].SlotNum |
|
|
maxSlotNum = tc.slots[len(tc.slots)-1].SlotNum - 1 |
|
|
maxSlotNum = tc.slots[len(tc.slots)-1].SlotNum - 1 |
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
minMaxBatchNumSlots := []testSlot{} |
|
|
minMaxBatchNumSlots := []testSlot{} |
|
@ -214,7 +214,7 @@ func TestGetSlots(t *testing.T) { |
|
|
minSlotNum = tc.slots[0].SlotNum |
|
|
minSlotNum = tc.slots[0].SlotNum |
|
|
maxSlotNum = tc.slots[0].SlotNum |
|
|
maxSlotNum = tc.slots[0].SlotNum |
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
minMaxBatchNumSlots = []testSlot{} |
|
|
minMaxBatchNumSlots = []testSlot{} |
|
@ -230,7 +230,7 @@ func TestGetSlots(t *testing.T) { |
|
|
minSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 1 |
|
|
minSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 1 |
|
|
maxSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 5 |
|
|
maxSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 5 |
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderAsc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
emptySlots := []testSlot{} |
|
|
emptySlots := []testSlot{} |
|
@ -246,7 +246,7 @@ func TestGetSlots(t *testing.T) { |
|
|
minSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 1 |
|
|
minSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 1 |
|
|
maxSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 5 |
|
|
maxSlotNum = tc.slots[len(tc.slots)-1].SlotNum + 5 |
|
|
fetchedSlots = []testSlot{} |
|
|
fetchedSlots = []testSlot{} |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
err = doGoodReqPaginated(path, historydb.OrderDesc, &testSlotsResponse{}, appendIter) |
|
|
err = doGoodReqPaginated(path, historydb.OrderDesc, &testSlotsResponse{}, appendIter) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
flippedEmptySlots := []testSlot{} |
|
|
flippedEmptySlots := []testSlot{} |
|
@ -259,7 +259,7 @@ func TestGetSlots(t *testing.T) { |
|
|
|
|
|
|
|
|
// 400
|
|
|
// 400
|
|
|
// No filters
|
|
|
// No filters
|
|
|
path = fmt.Sprintf("%s?limit=%d&fromItem=", endpoint, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?limit=%d", endpoint, limit) |
|
|
err = doBadReq("GET", path, nil, 400) |
|
|
err = doBadReq("GET", path, nil, 400) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
// Invalid maxSlotNum
|
|
|
// Invalid maxSlotNum
|
|
@ -273,12 +273,12 @@ func TestGetSlots(t *testing.T) { |
|
|
// Invalid minSlotNum / maxSlotNum (minSlotNum > maxSlotNum)
|
|
|
// Invalid minSlotNum / maxSlotNum (minSlotNum > maxSlotNum)
|
|
|
maxSlotNum = tc.slots[1].SlotNum |
|
|
maxSlotNum = tc.slots[1].SlotNum |
|
|
minSlotNum = tc.slots[4].SlotNum |
|
|
minSlotNum = tc.slots[4].SlotNum |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d&fromItem=", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&minSlotNum=%d&limit=%d", endpoint, maxSlotNum, minSlotNum, limit) |
|
|
err = doBadReq("GET", path, nil, 400) |
|
|
err = doBadReq("GET", path, nil, 400) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
// 404
|
|
|
// 404
|
|
|
maxSlotNum = tc.slots[1].SlotNum |
|
|
maxSlotNum = tc.slots[1].SlotNum |
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&wonByEthereumAddress=%s&limit=%d&fromItem=", endpoint, maxSlotNum, tc.coordinators[3].Bidder.String(), limit) |
|
|
|
|
|
|
|
|
path = fmt.Sprintf("%s?maxSlotNum=%d&wonByEthereumAddress=%s&limit=%d", endpoint, maxSlotNum, tc.coordinators[3].Bidder.String(), limit) |
|
|
err = doBadReq("GET", path, nil, 404) |
|
|
err = doBadReq("GET", path, nil, 404) |
|
|
assert.NoError(t, err) |
|
|
assert.NoError(t, err) |
|
|
} |
|
|
} |
|
|