use of tech.pegasys.teku.api.response.v1.validator.PostSyncDutiesResponse in project teku by ConsenSys.
the class PostSyncDutiesIntegrationTest method shouldGetSyncCommitteeDuties.
@Test
void shouldGetSyncCommitteeDuties() throws IOException {
startRestAPIAtGenesis(SpecMilestone.ALTAIR);
final SafeFuture<Optional<SyncCommitteeDuties>> out = SafeFuture.completedFuture(Optional.of(new SyncCommitteeDuties(List.of(new SyncCommitteeDuty(VALIDATOR_KEYS.get(1).getPublicKey(), 1, IntSet.of(11))))));
when(syncService.getCurrentSyncState()).thenReturn(SyncState.IN_SYNC);
when(validatorApiChannel.getSyncCommitteeDuties(ONE, validators)).thenReturn(out);
Response response = post(PostSyncDuties.ROUTE.replace("{epoch}", "1"), jsonProvider.objectToJSON(validators));
Assertions.assertThat(response.code()).isEqualTo(SC_OK);
final PostSyncDutiesResponse dutiesResponse = jsonProvider.jsonToObject(response.body().string(), PostSyncDutiesResponse.class);
assertThat(dutiesResponse.data.get(0)).isEqualTo(new tech.pegasys.teku.api.response.v1.validator.SyncCommitteeDuty(new BLSPubKey(VALIDATOR_KEYS.get(1).getPublicKey()), ONE, IntSet.of(11)));
}
Aggregations