use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionSessionManagementUnitTest method shouldImportContextWithUnknownSessionMgmtType.
@Test
void shouldImportContextWithUnknownSessionMgmtType() throws ConfigurationException {
// Given
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
int sessMgmtTypeId = 100;
config.addProperty(ExtensionSessionManagement.CONTEXT_CONFIG_SESSION_TYPE, sessMgmtTypeId);
// When
extSessMgmt.importContextData(context, config);
// Then
verify(context, times(0)).setSessionManagementMethod(any());
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionSessionManagementUnitTest method shouldImportContextWithHttpSessionMgmtType.
@Test
void shouldImportContextWithHttpSessionMgmtType() throws ConfigurationException {
// Given
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
int sessMgmtTypeId = 1;
config.addProperty(ExtensionSessionManagement.CONTEXT_CONFIG_SESSION_TYPE, sessMgmtTypeId);
// When
extSessMgmt.importContextData(context, config);
// Then
verify(context).setSessionManagementMethod(any(HttpAuthSessionManagementMethod.class));
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class PluginPassiveScannerUnitTest method createConfiguration.
private static Configuration createConfiguration(int pluginId, Boolean enabled, AlertThreshold alertThreshold) {
ZapXmlConfiguration configuration = new ZapXmlConfiguration();
addConfiguration(configuration, 0, pluginId, enabled, alertThreshold);
return configuration;
}
use of org.zaproxy.zap.utils.ZapXmlConfiguration in project zaproxy by zaproxy.
the class ExtensionAuthorizationUnitTest method shouldImportContextWithNoAuthorizationDetectionMethod.
@Test
void shouldImportContextWithNoAuthorizationDetectionMethod() throws ConfigurationException {
// Given
Context context = mock(Context.class);
Configuration config = new ZapXmlConfiguration();
// 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 ExtensionParamUnitTest method createTestConfig.
private static FileConfiguration createTestConfig(boolean... states) {
ZapXmlConfiguration config = new ZapXmlConfiguration();
if (states == null || states.length == 0) {
return config;
}
for (int i = 0; i < states.length; ++i) {
String elementBaseKey = "extensions.extension(" + i + ").";
config.setProperty(elementBaseKey + "name", "Extension " + (i + 1));
config.setProperty(elementBaseKey + "enabled", states[i]);
}
return config;
}
Aggregations