use of com.endava.cats.args.FilesArguments in project cats by Endava.
the class FuzzingDataFactoryTest method setup.
@BeforeEach
void setup() {
filesArguments = Mockito.mock(FilesArguments.class);
processingArguments = Mockito.mock(ProcessingArguments.class);
Mockito.when(processingArguments.isUseExamples()).thenReturn(true);
Mockito.when(processingArguments.getContentType()).thenReturn("application/json");
fuzzingDataFactory = new FuzzingDataFactory(filesArguments, processingArguments, catsGlobalContext);
}
use of com.endava.cats.args.FilesArguments in project cats by Endava.
the class SecurityFuzzerTest method setup.
@BeforeEach
void setup() {
catsDSLParser = new CatsDSLParser();
catsUtil = new CatsUtil(catsDSLParser);
serviceCaller = Mockito.mock(ServiceCaller.class);
filesArguments = new FilesArguments(catsUtil);
customFuzzerUtil = new CustomFuzzerUtil(serviceCaller, catsUtil, testCaseListener, catsDSLParser);
securityFuzzer = new SecurityFuzzer(filesArguments, customFuzzerUtil);
ReflectionTestUtils.setField(testCaseListener, "testCaseExporter", Mockito.mock(TestCaseExporter.class));
}
use of com.endava.cats.args.FilesArguments in project cats by Endava.
the class FunctionalFuzzerTest method setup.
@BeforeEach
void setup() {
catsDSLParser = new CatsDSLParser();
catsUtil = new CatsUtil(catsDSLParser);
serviceCaller = Mockito.mock(ServiceCaller.class);
filesArguments = new FilesArguments(catsUtil);
customFuzzerUtil = new CustomFuzzerUtil(serviceCaller, catsUtil, testCaseListener, catsDSLParser);
functionalFuzzer = new FunctionalFuzzer(filesArguments, customFuzzerUtil);
filesArguments.getCustomFuzzerDetails().clear();
ReflectionTestUtils.setField(testCaseListener, "testCaseExporter", Mockito.mock(TestCaseExporter.class));
}
use of com.endava.cats.args.FilesArguments in project cats by Endava.
the class FunctionalFuzzerTest method setupFuzzingData.
private FuzzingData setupFuzzingData(CatsResponse catsResponse, JsonObject jsonObject, String... customFieldValues) throws IOException {
Map<String, List<String>> responses = new HashMap<>();
responses.put("200", Collections.singletonList("response"));
FuzzingData data = FuzzingData.builder().path("path1").payload("{\"field\":\"oldValue\"}").responses(responses).responseCodes(Collections.singleton("200")).reqSchema(new StringSchema()).method(HttpMethod.POST).build();
CatsUtil mockCatsUtil = Mockito.mock(CatsUtil.class);
Mockito.when(mockCatsUtil.parseYaml(any())).thenReturn(createCustomFuzzerFile(customFieldValues));
Mockito.when(serviceCaller.call(Mockito.any())).thenReturn(catsResponse);
filesArguments = new FilesArguments(mockCatsUtil);
customFuzzerUtil = new CustomFuzzerUtil(serviceCaller, mockCatsUtil, testCaseListener, catsDSLParser);
functionalFuzzer = new FunctionalFuzzer(filesArguments, customFuzzerUtil);
ReflectionTestUtils.setField(filesArguments, "customFuzzerFile", new File("custom"));
return data;
}
use of com.endava.cats.args.FilesArguments in project cats by Endava.
the class AbugidasCharsInStringFieldsSanitizeValidateFuzzerTest method setup.
@BeforeEach
void setup() {
ServiceCaller serviceCaller = Mockito.mock(ServiceCaller.class);
TestCaseListener testCaseListener = Mockito.mock(TestCaseListener.class);
FilesArguments filesArguments = Mockito.mock(FilesArguments.class);
abugidasCharsInStringFieldsSanitizeValidateFuzzer = new AbugidasCharsInStringFieldsSanitizeValidateFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
Mockito.when(testCaseListener.isFieldNotADiscriminator(Mockito.anyString())).thenReturn(true);
Mockito.when(testCaseListener.isFieldNotADiscriminator("pet#type")).thenReturn(false);
}
Aggregations