Search in sources :

Example 6 with CatsDSLParser

use of com.endava.cats.dsl.CatsDSLParser in project cats by Endava.

the class CatsUtilTest method shouldAddTopElement.

@Test
void shouldAddTopElement() {
    CatsUtil catsUtil = new CatsUtil(new CatsDSLParser());
    String payload = "{\"field\":\"value\", \"anotherField\":{\"subfield\": \"otherValue\"}}";
    Map<String, String> currentPathValues = Collections.singletonMap("additionalProperties", "{topElement=metadata, mapValues={test1=value1,test2=value2}}");
    String updatedPayload = catsUtil.setAdditionalPropertiesToPayload(currentPathValues, payload);
    Assertions.assertThat(updatedPayload).contains("metadata").contains("test1");
}
Also used : CatsDSLParser(com.endava.cats.dsl.CatsDSLParser) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with CatsDSLParser

use of com.endava.cats.dsl.CatsDSLParser in project cats by Endava.

the class CatsUtilTest method givenAYamlFile_whenParseYamlIsCalled_thenTheYamlFileIsProperlyParsed.

@Test
void givenAYamlFile_whenParseYamlIsCalled_thenTheYamlFileIsProperlyParsed() throws Exception {
    CatsUtil catsUtil = new CatsUtil(new CatsDSLParser());
    Map<String, Map<String, Object>> yaml = catsUtil.parseYaml("src/test/resources/test.yml");
    Assertions.assertThat(yaml.get("all")).isNotNull();
    Assertions.assertThat(yaml.get("all").get("Authorization")).isNotNull();
}
Also used : Map(java.util.Map) CatsDSLParser(com.endava.cats.dsl.CatsDSLParser) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

CatsDSLParser (com.endava.cats.dsl.CatsDSLParser)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 QuarkusTest (io.quarkus.test.junit.QuarkusTest)4 Test (org.junit.jupiter.api.Test)4 FilesArguments (com.endava.cats.args.FilesArguments)2 CustomFuzzerUtil (com.endava.cats.fuzzer.CustomFuzzerUtil)2 ServiceCaller (com.endava.cats.io.ServiceCaller)2 FuzzingResult (com.endava.cats.model.FuzzingResult)2 FuzzingStrategy (com.endava.cats.model.FuzzingStrategy)2 TestCaseExporter (com.endava.cats.report.TestCaseExporter)2 CatsUtil (com.endava.cats.util.CatsUtil)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Map (java.util.Map)1 CsvSource (org.junit.jupiter.params.provider.CsvSource)1