use of tech.pegasys.teku.api.SchemaObjectProvider in project teku by ConsenSys.
the class GetNewBlockV2Test method shouldReturnBlockWithoutGraffiti.
@Test
void shouldReturnBlockWithoutGraffiti() throws Exception {
final Map<String, String> pathParams = Map.of(SLOT, "1");
final SchemaObjectProvider schemaProvider = new SchemaObjectProvider(spec);
final Map<String, List<String>> queryParams = Map.of(RANDAO_REVEAL, List.of(signature.toHexString()));
final tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock randomBeaconBlock = dataStructureUtil.randomBeaconBlock(ONE);
final BeaconBlock altairBlock = schemaProvider.getBeaconBlock(randomBeaconBlock);
when(context.queryParamMap()).thenReturn(queryParams);
when(context.pathParamMap()).thenReturn(pathParams);
when(provider.getMilestoneAtSlot(UInt64.ONE)).thenReturn(SpecMilestone.ALTAIR);
when(provider.getUnsignedBeaconBlockAtSlot(ONE, signature, Optional.empty())).thenReturn(SafeFuture.completedFuture(Optional.of(altairBlock)));
handler.handle(context);
verify(context).future(args.capture());
SafeFuture<String> result = args.getValue();
assertThat(result).isCompletedWithValue(jsonProvider.objectToJSON(new GetNewBlockResponseV2(SpecMilestone.ALTAIR, altairBlock)));
}
use of tech.pegasys.teku.api.SchemaObjectProvider in project teku by ConsenSys.
the class SchemaObjectsTestFixture method beaconBlockAltair.
public BeaconBlock beaconBlockAltair() {
final Spec altairSpec = TestSpecFactory.createMainnetAltair();
final DataStructureUtil altairData = new DataStructureUtil(altairSpec);
final SchemaObjectProvider schemaObjectProvider = new SchemaObjectProvider(altairSpec);
return schemaObjectProvider.getBeaconBlock(altairData.randomBeaconBlock(UInt64.ONE));
}
Aggregations