Search in sources :

Example 1 with GetAggregatedAttestationResponse

use of tech.pegasys.teku.api.response.v1.validator.GetAggregatedAttestationResponse in project teku by ConsenSys.

the class OkHttpValidatorRestApiClientTest method createAggregate_WhenSuccess_ReturnsAttestation.

@Test
public void createAggregate_WhenSuccess_ReturnsAttestation() {
    final Bytes32 attestationHashTreeRoot = Bytes32.random();
    final Attestation expectedAttestation = schemaObjects.attestation();
    mockWebServer.enqueue(new MockResponse().setResponseCode(SC_OK).setBody(asJson(new GetAggregatedAttestationResponse(expectedAttestation))));
    final Optional<Attestation> attestation = apiClient.createAggregate(UInt64.ONE, attestationHashTreeRoot);
    assertThat(attestation).isPresent();
    assertThat(attestation.get()).usingRecursiveComparison().isEqualTo(expectedAttestation);
}
Also used : GetAggregatedAttestationResponse(tech.pegasys.teku.api.response.v1.validator.GetAggregatedAttestationResponse) MockResponse(okhttp3.mockwebserver.MockResponse) Bytes32(org.apache.tuweni.bytes.Bytes32) Attestation(tech.pegasys.teku.api.schema.Attestation) Test(org.junit.jupiter.api.Test)

Aggregations

MockResponse (okhttp3.mockwebserver.MockResponse)1 Bytes32 (org.apache.tuweni.bytes.Bytes32)1 Test (org.junit.jupiter.api.Test)1 GetAggregatedAttestationResponse (tech.pegasys.teku.api.response.v1.validator.GetAggregatedAttestationResponse)1 Attestation (tech.pegasys.teku.api.schema.Attestation)1