Search in sources :

Example 6 with FilesArguments

use of com.endava.cats.args.FilesArguments in project cats by Endava.

the class AbugidasCharsInStringFieldsValidateSanitizeFuzzerTest method setup.

@BeforeEach
void setup() {
    ServiceCaller serviceCaller = Mockito.mock(ServiceCaller.class);
    TestCaseListener testCaseListener = Mockito.mock(TestCaseListener.class);
    FilesArguments filesArguments = Mockito.mock(FilesArguments.class);
    abugidasCharsInStringFieldsValidateSanitizeFuzzer = new AbugidasCharsInStringFieldsValidateSanitizeFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
    Mockito.when(testCaseListener.isFieldNotADiscriminator(Mockito.anyString())).thenReturn(true);
    Mockito.when(testCaseListener.isFieldNotADiscriminator("pet#type")).thenReturn(false);
}
Also used : FilesArguments(com.endava.cats.args.FilesArguments) ServiceCaller(com.endava.cats.io.ServiceCaller) TestCaseListener(com.endava.cats.report.TestCaseListener) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with FilesArguments

use of com.endava.cats.args.FilesArguments in project cats by Endava.

the class BypassAuthenticationFuzzerTest method setup.

@BeforeEach
void setup() {
    catsUtil = Mockito.mock(CatsUtil.class);
    filesArguments = new FilesArguments(catsUtil);
    serviceCaller = Mockito.mock(ServiceCaller.class);
    bypassAuthenticationFuzzer = new BypassAuthenticationFuzzer(serviceCaller, testCaseListener, filesArguments);
    ReflectionTestUtils.setField(testCaseListener, "testCaseExporter", Mockito.mock(TestCaseExporter.class));
}
Also used : FilesArguments(com.endava.cats.args.FilesArguments) CatsUtil(com.endava.cats.util.CatsUtil) ServiceCaller(com.endava.cats.io.ServiceCaller) TestCaseExporter(com.endava.cats.report.TestCaseExporter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with FilesArguments

use of com.endava.cats.args.FilesArguments in project cats by Endava.

the class WithinControlCharsInFieldsSanitizeValidateFuzzerTest method setup.

@BeforeEach
void setup() {
    ServiceCaller serviceCaller = Mockito.mock(ServiceCaller.class);
    TestCaseListener testCaseListener = Mockito.mock(TestCaseListener.class);
    FilesArguments filesArguments = Mockito.mock(FilesArguments.class);
    withinControlCharsInFieldsSanitizeValidateFuzzer = new WithinControlCharsInFieldsSanitizeValidateFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
    Mockito.when(testCaseListener.isFieldNotADiscriminator(Mockito.anyString())).thenReturn(true);
    Mockito.when(testCaseListener.isFieldNotADiscriminator("pet#type")).thenReturn(false);
}
Also used : FilesArguments(com.endava.cats.args.FilesArguments) ServiceCaller(com.endava.cats.io.ServiceCaller) TestCaseListener(com.endava.cats.report.TestCaseListener) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 9 with FilesArguments

use of com.endava.cats.args.FilesArguments in project cats by Endava.

the class ZalgoTextInStringFieldsValidateSanitizeFuzzerTest method setup.

@BeforeEach
void setup() {
    ServiceCaller serviceCaller = Mockito.mock(ServiceCaller.class);
    TestCaseListener testCaseListener = Mockito.mock(TestCaseListener.class);
    FilesArguments filesArguments = Mockito.mock(FilesArguments.class);
    zalgoTextInStringFieldsValidateSanitizeFuzzer = new ZalgoTextInStringFieldsValidateSanitizeFuzzer(serviceCaller, testCaseListener, catsUtil, filesArguments);
    Mockito.when(testCaseListener.isFieldNotADiscriminator(Mockito.anyString())).thenReturn(true);
    Mockito.when(testCaseListener.isFieldNotADiscriminator("pet#type")).thenReturn(false);
}
Also used : FilesArguments(com.endava.cats.args.FilesArguments) ServiceCaller(com.endava.cats.io.ServiceCaller) TestCaseListener(com.endava.cats.report.TestCaseListener) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 10 with FilesArguments

use of com.endava.cats.args.FilesArguments in project cats by Endava.

the class ServiceCallerTest method setupEach.

@BeforeEach
public void setupEach() throws Exception {
    FilesArguments filesArguments = new FilesArguments(catsUtil);
    TestCaseListener testCaseListener = Mockito.mock(TestCaseListener.class);
    serviceCaller = new ServiceCaller(catsGlobalContext, testCaseListener, catsUtil, filesArguments, catsDSLParser, authArguments, apiArguments, processingArguments);
    ReflectionTestUtils.setField(apiArguments, "server", "http://localhost:" + wireMockServer.port());
    ReflectionTestUtils.setField(authArguments, "basicAuth", "user:password");
    ReflectionTestUtils.setField(filesArguments, "refDataFile", new File("src/test/resources/refFields.yml"));
    ReflectionTestUtils.setField(filesArguments, "headersFile", new File("src/test/resources/headers.yml"));
    ReflectionTestUtils.setField(filesArguments, "params", List.of("id=1", "test=2"));
    ReflectionTestUtils.setField(authArguments, "sslKeystore", null);
    ReflectionTestUtils.setField(authArguments, "proxyHost", null);
    ReflectionTestUtils.setField(authArguments, "proxyPort", 0);
    filesArguments.loadHeaders();
    filesArguments.loadRefData();
    filesArguments.loadURLParams();
    catsGlobalContext.getPostSuccessfulResponses().clear();
}
Also used : FilesArguments(com.endava.cats.args.FilesArguments) File(java.io.File) TestCaseListener(com.endava.cats.report.TestCaseListener) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

FilesArguments (com.endava.cats.args.FilesArguments)11 BeforeEach (org.junit.jupiter.api.BeforeEach)10 ServiceCaller (com.endava.cats.io.ServiceCaller)8 TestCaseListener (com.endava.cats.report.TestCaseListener)6 CatsUtil (com.endava.cats.util.CatsUtil)4 CustomFuzzerUtil (com.endava.cats.fuzzer.CustomFuzzerUtil)3 TestCaseExporter (com.endava.cats.report.TestCaseExporter)3 CatsDSLParser (com.endava.cats.dsl.CatsDSLParser)2 File (java.io.File)2 ProcessingArguments (com.endava.cats.args.ProcessingArguments)1 FuzzingDataFactory (com.endava.cats.factory.FuzzingDataFactory)1 FuzzingData (com.endava.cats.model.FuzzingData)1 StringSchema (io.swagger.v3.oas.models.media.StringSchema)1 HashMap (java.util.HashMap)1 List (java.util.List)1