use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionAuthenticationUnitTest method shouldImportContextWithNoAuthenticationMethod.
@Test
void shouldImportContextWithNoAuthenticationMethod() throws ConfigurationException {
// Given
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
// When
extensionAuthentication.importContextData(context, config);
// Then
verify(context, times(0)).setAuthenticationMethod(any());
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionAuthorizationUnitTest method shouldImportContextWithUnknownAuthorizationDetectionMethod.
@Test
void shouldImportContextWithUnknownAuthorizationDetectionMethod() throws ConfigurationException {
// Given
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
config.setProperty("context.authorization.type", Integer.MIN_VALUE);
// When
extensionAuthorization.importContextData(context, config);
// Then
verify(context, times(0)).setAuthorizationDetectionMethod(any());
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class VariantFactoryUnitTest method shouldReturnAllVariantsWhenSet.
@Test
void shouldReturnAllVariantsWhenSet() throws Exception {
// Given
ScannerParam scanOptions = Mockito.mock(ScannerParam.class, withSettings().lenient());
Mockito.when(scanOptions.getConfig()).thenReturn(new ZapXmlConfiguration());
Mockito.when(scanOptions.getTargetParamsInjectable()).thenReturn(-1);
Mockito.when(scanOptions.getTargetParamsEnabledRPC()).thenReturn(-1);
HttpMessage message = new HttpMessage(new URI("https://www.example.com/path?query", true));
// When
List<Variant> variants = factory.createVariants(scanOptions, message);
// Then
assertThat(variants.size(), is(equalTo(13)));
assertThat(variants.get(0).getClass(), is(equalTo(VariantURLQuery.class)));
assertThat(variants.get(1).getClass(), is(equalTo(VariantODataIdQuery.class)));
assertThat(variants.get(2).getClass(), is(equalTo(VariantODataFilterQuery.class)));
assertThat(variants.get(3).getClass(), is(equalTo(VariantFormQuery.class)));
assertThat(variants.get(4).getClass(), is(equalTo(VariantMultipartFormParameters.class)));
assertThat(variants.get(5).getClass(), is(equalTo(VariantXMLQuery.class)));
assertThat(variants.get(6).getClass(), is(equalTo(VariantJSONQuery.class)));
assertThat(variants.get(7).getClass(), is(equalTo(VariantGWTQuery.class)));
assertThat(variants.get(8).getClass(), is(equalTo(VariantDirectWebRemotingQuery.class)));
assertThat(variants.get(9).getClass(), is(equalTo(VariantHeader.class)));
assertThat(variants.get(10).getClass(), is(equalTo(VariantURLPath.class)));
assertThat(variants.get(11).getClass(), is(equalTo(VariantCookie.class)));
assertThat(variants.get(12).getClass(), is(equalTo(VariantUserDefined.class)));
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class APIUnitTest method createOptionsParamApi.
private static OptionsParamApi createOptionsParamApi() {
OptionsParamApi optionsParamApi = new OptionsParamApi();
optionsParamApi.load(new ZapXmlConfiguration());
return optionsParamApi;
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class OptionsParamApiUnitTest method createTestConfig.
private static FileConfiguration createTestConfig() {
ZapXmlConfiguration config = new ZapXmlConfiguration();
config.setProperty(API_ENABLED_KEY, "false");
config.setProperty(API_SECURE_KEY, "true");
config.setProperty(API_KEY_KEY, "ApiKey");
config.setProperty(API_DISABLEKEY_KEY, "true");
config.setProperty(API_INCERRORDETAILS_KEY, "true");
config.setProperty(API_AUTOFILLKEY_KEY, "true");
config.setProperty(API_ENABLEJSONP_KEY, "true");
config.setProperty(API_NO_KEY_FOR_SAFE_OPS, "true");
config.setProperty(API_REPORT_PERM_ERRORS, "true");
return config;
}
Aggregations