From fc13e5f43b0fd03bf3f2057493b1381dbde69429 Mon Sep 17 00:00:00 2001 From: Mehdi AOUADI Date: Fri, 19 Jul 2024 18:22:50 +0200 Subject: [PATCH] fix integration tests --- .../PostAttestationsV2IntegrationTest.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java b/data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java index 605a4e4694a..a118d38c3b2 100644 --- a/data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java +++ b/data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java @@ -14,7 +14,6 @@ package tech.pegasys.teku.beaconrestapi.v2.beacon; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.Mockito.when; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST; import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK; @@ -57,12 +56,12 @@ void setup(final TestSpecInvocationContextProvider.SpecContext specContext) { @TestTemplate void shouldPostAttestations_NoErrors() throws Exception { - when(validatorApiChannel.sendSignedAttestations(anyList())) - .thenReturn(SafeFuture.completedFuture(Collections.emptyList())); - final List attestations = List.of(dataStructureUtil.randomAttestation(), dataStructureUtil.randomAttestation()); + when(validatorApiChannel.sendSignedAttestationsV2(specMilestone, attestations)) + .thenReturn(SafeFuture.completedFuture(Collections.emptyList())); + final Response response = post( PostAttestationsV2.ROUTE, @@ -87,9 +86,6 @@ void shouldPartiallyPostAttestations_ReturnsErrors() throws Exception { new SubmitDataError(UInt64.ZERO, "Bad attestation"); final SubmitDataError secondSubmitDataError = new SubmitDataError(UInt64.ONE, "Very bad attestation"); - when(validatorApiChannel.sendSignedAttestations(anyList())) - .thenReturn( - SafeFuture.completedFuture(List.of(firstSubmitDataError, secondSubmitDataError))); final List attestations = List.of( @@ -97,6 +93,10 @@ void shouldPartiallyPostAttestations_ReturnsErrors() throws Exception { dataStructureUtil.randomAttestation(), dataStructureUtil.randomAttestation()); + when(validatorApiChannel.sendSignedAttestationsV2(specMilestone, attestations)) + .thenReturn( + SafeFuture.completedFuture(List.of(firstSubmitDataError, secondSubmitDataError))); + final Response response = post( PostAttestationsV2.ROUTE, @@ -129,12 +129,12 @@ void shouldPartiallyPostAttestations_ReturnsErrors() throws Exception { @TestTemplate void shouldFailWhenMissingConsensusHeader() throws Exception { - when(validatorApiChannel.sendSignedAttestations(anyList())) - .thenReturn(SafeFuture.completedFuture(Collections.emptyList())); - final List attestations = List.of(dataStructureUtil.randomAttestation(), dataStructureUtil.randomAttestation()); + when(validatorApiChannel.sendSignedAttestationsV2(specMilestone, attestations)) + .thenReturn(SafeFuture.completedFuture(Collections.emptyList())); + final Response response = post( PostAttestationsV2.ROUTE, @@ -156,12 +156,12 @@ void shouldFailWhenMissingConsensusHeader() throws Exception { @TestTemplate void shouldFailWhenBadConsensusHeaderValue() throws Exception { - when(validatorApiChannel.sendSignedAttestations(anyList())) - .thenReturn(SafeFuture.completedFuture(Collections.emptyList())); - final List attestations = List.of(dataStructureUtil.randomAttestation(), dataStructureUtil.randomAttestation()); + when(validatorApiChannel.sendSignedAttestationsV2(specMilestone, attestations)) + .thenReturn(SafeFuture.completedFuture(Collections.emptyList())); + final Response response = post( PostAttestationsV2.ROUTE,