Search in sources :

Example 11 with ScannerParam

use of org.parosproxy.paros.core.scanner.ScannerParam in project zaproxy by zaproxy.

the class VariantFactoryUnitTest method shouldScanNullJsonValuesAsDefinedInOptions.

@ParameterizedTest
@ValueSource(booleans = { true, false })
void shouldScanNullJsonValuesAsDefinedInOptions(boolean scanNulls) {
    // Given
    ScannerParam scanOptions = mock(ScannerParam.class);
    given(scanOptions.getTargetParamsInjectable()).willReturn(ScannerParam.TARGET_POSTDATA);
    given(scanOptions.getTargetParamsEnabledRPC()).willReturn(ScannerParam.RPC_JSON);
    given(scanOptions.isScanNullJsonValues()).willReturn(scanNulls);
    HttpMessage message = new HttpMessage();
    // When
    List<Variant> variants = factory.createVariants(scanOptions, message);
    // Then
    VariantJSONQuery jsonVariant = getVariant(variants, VariantJSONQuery.class);
    assertThat(jsonVariant.isScanNullValues(), is(equalTo(scanNulls)));
}
Also used : Variant(org.parosproxy.paros.core.scanner.Variant) ScannerParam(org.parosproxy.paros.core.scanner.ScannerParam) VariantJSONQuery(org.parosproxy.paros.core.scanner.VariantJSONQuery) HttpMessage(org.parosproxy.paros.network.HttpMessage) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ScannerParam (org.parosproxy.paros.core.scanner.ScannerParam)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 Variant (org.parosproxy.paros.core.scanner.Variant)5 HttpMessage (org.parosproxy.paros.network.HttpMessage)5 Test (org.junit.jupiter.api.Test)4 OptionsParam (org.parosproxy.paros.model.OptionsParam)4 WithConfigsTest (org.zaproxy.zap.WithConfigsTest)4 ArrayList (java.util.ArrayList)2 ZapXmlConfiguration (org.zaproxy.zap.utils.ZapXmlConfiguration)2 URI (org.apache.commons.httpclient.URI)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1 Alert (org.parosproxy.paros.core.scanner.Alert)1 VariantJSONQuery (org.parosproxy.paros.core.scanner.VariantJSONQuery)1 Session (org.parosproxy.paros.model.Session)1 ConnectionParam (org.parosproxy.paros.network.ConnectionParam)1 AlertAPI (org.zaproxy.zap.extension.alert.AlertAPI)1 ExtensionAlert (org.zaproxy.zap.extension.alert.ExtensionAlert)1 AntiCsrfAPI (org.zaproxy.zap.extension.anticsrf.AntiCsrfAPI)1 AntiCsrfParam (org.zaproxy.zap.extension.anticsrf.AntiCsrfParam)1 ActiveScanAPI (org.zaproxy.zap.extension.ascan.ActiveScanAPI)1