use of com.checkmarx.flow.dto.EventResponse in project cx-flow by checkmarx-ltd.
the class FlowControllerTest method testScanApiWithDefaultParamters.
@Test
public void testScanApiWithDefaultParamters() {
FlowController.CxScanRequest request = getScanRequestWithDefaults();
FlowController.CxScanRequest referenceRequest = getScanRequestWithDefaults();
referenceRequest.setFilters(getDefaultFilters());
ArgumentCaptor<ScanRequest> captor = ArgumentCaptor.forClass(ScanRequest.class);
ResponseEntity<EventResponse> response = flowController.initiateScan(request, flowProperties.getToken());
verify(flowService).initiateAutomation(captor.capture());
ScanRequest actual = captor.getValue();
assertScanRequest(actual, referenceRequest);
assertOKResponse(response);
}
use of com.checkmarx.flow.dto.EventResponse in project cx-flow by checkmarx-ltd.
the class FlowControllerTest method testScanApiWithFilters.
@ParameterizedTest
@MethodSource("generateDataForScanApi")
public void testScanApiWithFilters(String filterSeverity, String filterCwe, String filterOwasp, String filterType, String filterStatus, String id) {
FlowController.CxScanRequest request = getScanRequestWithDefaults();
List<Filter> filters = prepareScanApiFilters(filterSeverity, filterCwe, filterOwasp, filterType, filterStatus);
request.setFilters(filters);
ResponseEntity<EventResponse> response = flowController.initiateScan(request, flowProperties.getToken());
ArgumentCaptor<ScanRequest> captor = ArgumentCaptor.forClass(ScanRequest.class);
verify(flowService).initiateAutomation(captor.capture());
ScanRequest actual = captor.getValue();
assertScanApiFilters(actual.getFilter().getSastFilters().getSimpleFilters(), filters);
assertOKResponse(response);
}
use of com.checkmarx.flow.dto.EventResponse in project cx-flow by checkmarx-ltd.
the class FlowControllerTest method testScanIncrementalParameter.
@ParameterizedTest
@CsvSource({ "false", "true" })
public void testScanIncrementalParameter(boolean incremental) {
FlowController.CxScanRequest request = getScanRequestWithDefaults();
request.setIncremental(incremental);
ResponseEntity<EventResponse> response = flowController.initiateScan(request, flowProperties.getToken());
assertOKResponse(response);
ArgumentCaptor<ScanRequest> captor = ArgumentCaptor.forClass(ScanRequest.class);
verify(flowService, times(1)).initiateAutomation(captor.capture());
ScanRequest actual = captor.getValue();
assertScanRequest(actual, request);
}
Aggregations