use of com.endava.cats.model.CatsHeader in project cats by Endava.
the class CheckSecurityHeadersFuzzerTest method shouldNotReportMissingSecurityHeaders.
@Test
void shouldNotReportMissingSecurityHeaders() {
FuzzingData data = FuzzingData.builder().headers(new HashSet<>(HEADERS)).requestContentTypes(Collections.singletonList("application/json")).reqSchema(new StringSchema()).build();
Mockito.doNothing().when(testCaseListener).reportResult(Mockito.any(), Mockito.eq(data), Mockito.any(), Mockito.eq(ResponseCodeFamily.TWOXX));
Mockito.doNothing().when(testCaseListener).reportError(Mockito.any(), Mockito.anyString(), Mockito.any());
List<CatsHeader> allHeaders = new ArrayList<>(SOME_SECURITY_HEADERS);
allHeaders.add(CatsHeader.builder().name("dummy").value("dummy").build());
CatsResponse catsResponse = CatsResponse.builder().body("{}").responseCode(200).headers(Stream.concat(allHeaders.stream(), MISSING_HEADERS.stream()).collect(Collectors.toList())).build();
Mockito.when(serviceCaller.call(Mockito.any())).thenReturn(catsResponse);
checkSecurityHeadersFuzzer.fuzz(data);
Mockito.verify(testCaseListener, Mockito.times(1)).reportResult(Mockito.any(), Mockito.eq(data), Mockito.any(), Mockito.eq(ResponseCodeFamily.TWOXX));
}
Aggregations