use of com.mercedesbenz.sechub.owaspzapwrapper.cli.CommandLineSettings in project sechub by mercedes-benz.
the class OwaspZapScanConfigurationFactoryTest method authentication_type_from_config_is_in_result.
@Test
void authentication_type_from_config_is_in_result() {
/* prepare */
CommandLineSettings settings = createSettingsMockWithNecessaryParts();
SecHubWebScanConfiguration config = simulateProvidedSecHubConfiguration(settings);
AuthenticationType type = AuthenticationType.FORM_BASED_AUTHENTICATION;
when(sechubWebConfigHelper.determineAuthenticationType(config)).thenReturn(type);
/* execute */
OwaspZapScanConfiguration result = factoryToTest.create(settings);
/* test */
assertEquals(result.getAuthenticationType(), type);
}
use of com.mercedesbenz.sechub.owaspzapwrapper.cli.CommandLineSettings in project sechub by mercedes-benz.
the class OwaspZapScanConfigurationFactoryTest method ajaxspider_enabled_from_settings_is_in_result.
@ParameterizedTest
@CsvSource({ "true", "false" })
void ajaxspider_enabled_from_settings_is_in_result(boolean enabled) {
/* prepare */
CommandLineSettings settings = createSettingsMockWithNecessaryParts();
when(settings.isAjaxSpiderEnabled()).thenReturn(enabled);
/* execute */
OwaspZapScanConfiguration result = factoryToTest.create(settings);
/* test */
assertEquals(result.isAjaxSpiderEnabled(), enabled);
}
use of com.mercedesbenz.sechub.owaspzapwrapper.cli.CommandLineSettings in project sechub by mercedes-benz.
the class OwaspZapScanConfigurationFactoryTest method active_scan_enabled_from_settings_is_in_result.
@ParameterizedTest
@CsvSource({ "true", "false" })
void active_scan_enabled_from_settings_is_in_result(boolean enabled) {
/* prepare */
CommandLineSettings settings = createSettingsMockWithNecessaryParts();
when(settings.isActiveScanEnabled()).thenReturn(enabled);
/* execute */
OwaspZapScanConfiguration result = factoryToTest.create(settings);
/* test */
assertEquals(result.isActiveScanEnabled(), enabled);
}
use of com.mercedesbenz.sechub.owaspzapwrapper.cli.CommandLineSettings in project sechub by mercedes-benz.
the class OwaspZapScanConfigurationFactoryTest method configuration_returned_by_provider_is_inside_result.
@Test
void configuration_returned_by_provider_is_inside_result() {
/* prepare */
CommandLineSettings settings = createSettingsMockWithNecessaryParts();
SecHubWebScanConfiguration config = simulateProvidedSecHubConfiguration(settings);
/* execute */
OwaspZapScanConfiguration result = factoryToTest.create(settings);
/* test */
assertEquals(result.getSecHubWebScanConfiguration(), config);
}
use of com.mercedesbenz.sechub.owaspzapwrapper.cli.CommandLineSettings in project sechub by mercedes-benz.
the class OwaspZapScanConfigurationFactoryTest method result_contains_server_config_with_arguments_from_environment_when_command_line_settings_not_set.
@ParameterizedTest
@CsvSource({ "https://zaproxy.example.com,8080,api-key,https://proxy.example.com,3333", "host,4711,secret,proxy,5312" })
void result_contains_server_config_with_arguments_from_environment_when_command_line_settings_not_set(String host, int port, String apiKey, String proxy, int proxyPort) {
/* prepare */
CommandLineSettings settings = mock(CommandLineSettings.class);
when(environmentVariableReader.readAsString(ZAP_HOST_ENV_VARIABLE_NAME)).thenReturn(host);
when(environmentVariableReader.readAsString(ZAP_API_KEY_ENV_VARIABLE_NAME)).thenReturn(apiKey);
when(environmentVariableReader.readAsInt(ZAP_PORT_ENV_VARIABLE_NAME)).thenReturn(port);
when(environmentVariableReader.readAsString(PROXY_HOST_ENV_VARIABLE_NAME)).thenReturn(proxy);
when(environmentVariableReader.readAsInt(PROXY_PORT_ENV_VARIABLE_NAME)).thenReturn(proxyPort);
/* execute */
OwaspZapScanConfiguration result = factoryToTest.create(settings);
/* test */
OwaspZapServerConfiguration serverConfig = result.getServerConfig();
assertNotNull(serverConfig);
assertEquals(host, serverConfig.getZaproxyHost());
assertEquals(port, serverConfig.getZaproxyPort());
assertEquals(apiKey, serverConfig.getZaproxyApiKey());
assertEquals(proxy, result.getProxyInformation().getHost());
assertEquals(proxyPort, result.getProxyInformation().getPort());
}
Aggregations