From fad24917a4bb6b9dce7ccd5019163df612b5b50f Mon Sep 17 00:00:00 2001 From: Mike Goldin Date: Wed, 9 Sep 2020 12:35:24 -0400 Subject: [PATCH] Update test cases and fix a bug --- pkg/testcases/router.go | 4 +++- .../200_0.json | 4 ---- .../attestations/200_0.json | 4 ---- .../root/200_0.json | 4 ---- tests/get/v1/beacon/blocks/42/200_0.json | 5 +++++ tests/get/v1/beacon/blocks/42/attestations/200_0.json | 5 +++++ tests/get/v1/beacon/blocks/42/root/200_0.json | 5 +++++ .../200_0.json | 4 ---- tests/get/v1/beacon/headers/42/200_0.json | 5 +++++ .../committees/2666/200_0.json | 4 ---- .../finality_checkpoints/200_0.json | 4 ---- .../fork/200_0.json | 4 ---- .../root/200_0.json | 4 ---- .../validators/1000/200_0.json | 4 ---- .../validators/200_0.json | 4 ---- tests/get/v1/beacon/states/42/committees/0/200_0.json | 5 +++++ .../get/v1/beacon/states/42/finality_checkpoints/200_0.json | 5 +++++ tests/get/v1/beacon/states/42/fork/200_0.json | 5 +++++ tests/get/v1/beacon/states/42/root/200_0.json | 5 +++++ tests/get/v1/beacon/states/42/validators/0/200_0.json | 5 +++++ tests/get/v1/beacon/states/42/validators/200_0.json | 5 +++++ .../200_0.json | 4 ---- tests/get/v1/debug/states/42/200_0.json | 5 +++++ tests/get/v1/validator/blocks/2666/200_0.json | 4 ---- tests/get/v1/validator/blocks/42/200_0.json | 5 +++++ tests/get/v1/validator/duties/attester/2666/200_0.json | 4 ---- tests/get/v1/validator/duties/attester/42/200_0.json | 5 +++++ tests/get/v1/validator/duties/proposer/2666/200_0.json | 4 ---- tests/get/v1/validator/duties/proposer/42/200_0.json | 5 +++++ 29 files changed, 73 insertions(+), 57 deletions(-) delete mode 100644 tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json delete mode 100644 tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/attestations/200_0.json delete mode 100644 tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json create mode 100644 tests/get/v1/beacon/blocks/42/200_0.json create mode 100644 tests/get/v1/beacon/blocks/42/attestations/200_0.json create mode 100644 tests/get/v1/beacon/blocks/42/root/200_0.json delete mode 100644 tests/get/v1/beacon/headers/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json create mode 100644 tests/get/v1/beacon/headers/42/200_0.json delete mode 100644 tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/committees/2666/200_0.json delete mode 100644 tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/finality_checkpoints/200_0.json delete mode 100644 tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/fork/200_0.json delete mode 100644 tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json delete mode 100644 tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/1000/200_0.json delete mode 100644 tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/200_0.json create mode 100644 tests/get/v1/beacon/states/42/committees/0/200_0.json create mode 100644 tests/get/v1/beacon/states/42/finality_checkpoints/200_0.json create mode 100644 tests/get/v1/beacon/states/42/fork/200_0.json create mode 100644 tests/get/v1/beacon/states/42/root/200_0.json create mode 100644 tests/get/v1/beacon/states/42/validators/0/200_0.json create mode 100644 tests/get/v1/beacon/states/42/validators/200_0.json delete mode 100644 tests/get/v1/debug/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json create mode 100644 tests/get/v1/debug/states/42/200_0.json delete mode 100644 tests/get/v1/validator/blocks/2666/200_0.json create mode 100644 tests/get/v1/validator/blocks/42/200_0.json delete mode 100644 tests/get/v1/validator/duties/attester/2666/200_0.json create mode 100644 tests/get/v1/validator/duties/attester/42/200_0.json delete mode 100644 tests/get/v1/validator/duties/proposer/2666/200_0.json create mode 100644 tests/get/v1/validator/duties/proposer/42/200_0.json diff --git a/pkg/testcases/router.go b/pkg/testcases/router.go index 1c1b3e6..48cf33d 100644 --- a/pkg/testcases/router.go +++ b/pkg/testcases/router.go @@ -42,6 +42,8 @@ func (c Case) execOperation(ctx context.Context) (*oapi.ExecutorResult, error) { func (c Case) execGetOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { switch { + case strings.Contains(route, "/validator/"): + return c.execGetValidatorOperation(ctx, route) case strings.Contains(route, "/node/"): return c.execGetNodeOperation(ctx, route) case strings.Contains(route, "/debug/"): @@ -185,7 +187,7 @@ func (c Case) execGetValidatorOperation(ctx context.Context, route string) (*oap return oapi.ExecGetValidatorBlocks(ctx, opts) case strings.Contains(route, "/attestation_data"): return oapi.ExecGetValidatorAttestationData(ctx, c.Config.QueryParams) - case strings.Contains(route, "/aggregate_attestations"): + case strings.Contains(route, "/aggregate_attestation"): return oapi.ExecGetValidatorAggregateAttestation(ctx, c.Config.QueryParams) } diff --git a/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json b/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json deleted file mode 100644 index 9a7c861..0000000 --- a/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024" -} diff --git a/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/attestations/200_0.json b/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/attestations/200_0.json deleted file mode 100644 index d670540..0000000 --- a/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/attestations/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/attestations" -} diff --git a/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json b/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json deleted file mode 100644 index 1dd1839..0000000 --- a/tests/get/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/blocks/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root" -} diff --git a/tests/get/v1/beacon/blocks/42/200_0.json b/tests/get/v1/beacon/blocks/42/200_0.json new file mode 100644 index 0000000..3adba74 --- /dev/null +++ b/tests/get/v1/beacon/blocks/42/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/blocks/42", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/blocks/42/attestations/200_0.json b/tests/get/v1/beacon/blocks/42/attestations/200_0.json new file mode 100644 index 0000000..a557102 --- /dev/null +++ b/tests/get/v1/beacon/blocks/42/attestations/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/blocks/42/attestations", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/blocks/42/root/200_0.json b/tests/get/v1/beacon/blocks/42/root/200_0.json new file mode 100644 index 0000000..73c5c21 --- /dev/null +++ b/tests/get/v1/beacon/blocks/42/root/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/blocks/42/root", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/headers/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json b/tests/get/v1/beacon/headers/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json deleted file mode 100644 index b93d33f..0000000 --- a/tests/get/v1/beacon/headers/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/headers/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024" -} diff --git a/tests/get/v1/beacon/headers/42/200_0.json b/tests/get/v1/beacon/headers/42/200_0.json new file mode 100644 index 0000000..1b473ec --- /dev/null +++ b/tests/get/v1/beacon/headers/42/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/headers/42", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/committees/2666/200_0.json b/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/committees/2666/200_0.json deleted file mode 100644 index c2c6b80..0000000 --- a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/committees/2666/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/committees/2666" -} diff --git a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/finality_checkpoints/200_0.json b/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/finality_checkpoints/200_0.json deleted file mode 100644 index 6351ab2..0000000 --- a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/finality_checkpoints/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/finality_checkpoints" -} diff --git a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/fork/200_0.json b/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/fork/200_0.json deleted file mode 100644 index 8e738d3..0000000 --- a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/fork/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/fork" -} diff --git a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json b/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json deleted file mode 100644 index 62e1a06..0000000 --- a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/root" -} diff --git a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/1000/200_0.json b/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/1000/200_0.json deleted file mode 100644 index 3443ccd..0000000 --- a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/1000/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/1000" -} diff --git a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/200_0.json b/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/200_0.json deleted file mode 100644 index 27bb04f..0000000 --- a/tests/get/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/validators" -} diff --git a/tests/get/v1/beacon/states/42/committees/0/200_0.json b/tests/get/v1/beacon/states/42/committees/0/200_0.json new file mode 100644 index 0000000..dc37a64 --- /dev/null +++ b/tests/get/v1/beacon/states/42/committees/0/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/states/42/committees/0", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/states/42/finality_checkpoints/200_0.json b/tests/get/v1/beacon/states/42/finality_checkpoints/200_0.json new file mode 100644 index 0000000..d78b3ed --- /dev/null +++ b/tests/get/v1/beacon/states/42/finality_checkpoints/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/states/42/finality_checkpoints", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/states/42/fork/200_0.json b/tests/get/v1/beacon/states/42/fork/200_0.json new file mode 100644 index 0000000..103385b --- /dev/null +++ b/tests/get/v1/beacon/states/42/fork/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/states/42/fork", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/states/42/root/200_0.json b/tests/get/v1/beacon/states/42/root/200_0.json new file mode 100644 index 0000000..bcdadc6 --- /dev/null +++ b/tests/get/v1/beacon/states/42/root/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/states/42/root", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/states/42/validators/0/200_0.json b/tests/get/v1/beacon/states/42/validators/0/200_0.json new file mode 100644 index 0000000..266696a --- /dev/null +++ b/tests/get/v1/beacon/states/42/validators/0/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/states/42/validators/0", + "awaitSlot": 42 +} diff --git a/tests/get/v1/beacon/states/42/validators/200_0.json b/tests/get/v1/beacon/states/42/validators/200_0.json new file mode 100644 index 0000000..05502e9 --- /dev/null +++ b/tests/get/v1/beacon/states/42/validators/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/beacon/states/42/validators", + "awaitSlot": 42 +} diff --git a/tests/get/v1/debug/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json b/tests/get/v1/debug/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json deleted file mode 100644 index 42a2ae0..0000000 --- a/tests/get/v1/debug/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/debug/beacon/states/0x893bb70e33f1d66b56bc955e4bd1a897eda5a70447ae9fd9f293999aa5525024" -} diff --git a/tests/get/v1/debug/states/42/200_0.json b/tests/get/v1/debug/states/42/200_0.json new file mode 100644 index 0000000..10a7806 --- /dev/null +++ b/tests/get/v1/debug/states/42/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/debug/beacon/states/42", + "awaitSlot": 42 +} diff --git a/tests/get/v1/validator/blocks/2666/200_0.json b/tests/get/v1/validator/blocks/2666/200_0.json deleted file mode 100644 index 9667042..0000000 --- a/tests/get/v1/validator/blocks/2666/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/validator/blocks/2666" -} diff --git a/tests/get/v1/validator/blocks/42/200_0.json b/tests/get/v1/validator/blocks/42/200_0.json new file mode 100644 index 0000000..e7eb267 --- /dev/null +++ b/tests/get/v1/validator/blocks/42/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/validator/blocks/42", + "awaitSlot": 42 +} diff --git a/tests/get/v1/validator/duties/attester/2666/200_0.json b/tests/get/v1/validator/duties/attester/2666/200_0.json deleted file mode 100644 index aabcf90..0000000 --- a/tests/get/v1/validator/duties/attester/2666/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/validator/duties/attester/2666" -} diff --git a/tests/get/v1/validator/duties/attester/42/200_0.json b/tests/get/v1/validator/duties/attester/42/200_0.json new file mode 100644 index 0000000..5549224 --- /dev/null +++ b/tests/get/v1/validator/duties/attester/42/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/validator/duties/attester/42", + "awaitSlot": 42 +} diff --git a/tests/get/v1/validator/duties/proposer/2666/200_0.json b/tests/get/v1/validator/duties/proposer/2666/200_0.json deleted file mode 100644 index 08a048d..0000000 --- a/tests/get/v1/validator/duties/proposer/2666/200_0.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "method": "GET", - "route": "/eth/v1/validator/duties/proposer/2666" -} diff --git a/tests/get/v1/validator/duties/proposer/42/200_0.json b/tests/get/v1/validator/duties/proposer/42/200_0.json new file mode 100644 index 0000000..bb26ed3 --- /dev/null +++ b/tests/get/v1/validator/duties/proposer/42/200_0.json @@ -0,0 +1,5 @@ +{ + "method": "GET", + "route": "/eth/v1/validator/duties/proposer/42", + "awaitSlot": 42 +}