Search in sources :

Example 11 with Attestation

use of tech.pegasys.teku.api.schema.Attestation in project teku by ConsenSys.

the class OkHttpValidatorRestApiClientTest method sendSignedAttestation_WhenBadParameters_ThrowsIllegalArgumentException.

@Test
public void sendSignedAttestation_WhenBadParameters_ThrowsIllegalArgumentException() {
    final Attestation attestation = schemaObjects.attestation();
    final PostDataFailureResponse response = new PostDataFailureResponse(SC_BAD_REQUEST, "Computer said no", List.of(new PostDataFailure(UInt64.ZERO, "Bad")));
    mockWebServer.enqueue(new MockResponse().setResponseCode(SC_BAD_REQUEST).setBody(asJson(response)));
    assertThat(apiClient.sendSignedAttestations(List.of(attestation))).isPresent().get().usingRecursiveComparison().isEqualTo(response);
}
Also used : PostDataFailureResponse(tech.pegasys.teku.api.response.v1.beacon.PostDataFailureResponse) MockResponse(okhttp3.mockwebserver.MockResponse) PostDataFailure(tech.pegasys.teku.api.response.v1.beacon.PostDataFailure) Attestation(tech.pegasys.teku.api.schema.Attestation) Test(org.junit.jupiter.api.Test)

Aggregations

Attestation (tech.pegasys.teku.api.schema.Attestation)11 Test (org.junit.jupiter.api.Test)7 MockResponse (okhttp3.mockwebserver.MockResponse)4 List (java.util.List)2 Bytes32 (org.apache.tuweni.bytes.Bytes32)2 PostDataFailure (tech.pegasys.teku.api.response.v1.beacon.PostDataFailure)2 PostDataFailureResponse (tech.pegasys.teku.api.response.v1.beacon.PostDataFailureResponse)2 GetAggregatedAttestationResponse (tech.pegasys.teku.api.response.v1.validator.GetAggregatedAttestationResponse)2 SignedBlockAndState (tech.pegasys.teku.spec.datastructures.blocks.SignedBlockAndState)2 Throwables (com.google.common.base.Throwables)1 Context (io.javalin.http.Context)1 Handler (io.javalin.http.Handler)1 HttpMethod (io.javalin.plugin.openapi.annotations.HttpMethod)1 OpenApi (io.javalin.plugin.openapi.annotations.OpenApi)1 OpenApiContent (io.javalin.plugin.openapi.annotations.OpenApiContent)1 OpenApiParam (io.javalin.plugin.openapi.annotations.OpenApiParam)1 OpenApiResponse (io.javalin.plugin.openapi.annotations.OpenApiResponse)1 IntList (it.unimi.dsi.fastutil.ints.IntList)1 Collections.emptyList (java.util.Collections.emptyList)1 Map (java.util.Map)1