Search in sources :

Example 6 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class DefaultFetchFilterUnitTest method shouldFilterOutOfScopeUriAsOutOfScope.

@Test
public void shouldFilterOutOfScopeUriAsOutOfScope() throws Exception {
    // Given
    filter.addScopeRegex("scope.example.com");
    URI uri = createUri("http://example.com");
    // When
    FetchStatus status = filter.checkFilter(uri);
    // Then
    assertThat(status, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 7 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class DefaultFetchFilterUnitTest method shouldFilterAlwaysInScopeUriAsValid.

@Test
public void shouldFilterAlwaysInScopeUriAsValid() throws Exception {
    // Given
    filter.setDomainsAlwaysInScope(domainsAlwaysInScope("example.com"));
    URI uri = createUri("https://example.com");
    // When
    FetchStatus status = filter.checkFilter(uri);
    // Then
    assertThat(status, is(equalTo(FetchStatus.VALID)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 8 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class DefaultFetchFilterUnitTest method shouldFilterNonExcludedInContextUriAsValid.

@Test
public void shouldFilterNonExcludedInContextUriAsValid() throws Exception {
    // Given
    filter.setScanContext(contextInScope(true));
    filter.setExcludeRegexes(excludeRegexes("subdomain\\.example\\.com.*"));
    URI uri = createUri("http://example.com");
    // When
    FetchStatus status = filter.checkFilter(uri);
    // Then
    assertThat(status, is(equalTo(FetchStatus.VALID)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 9 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class DefaultFetchFilterUnitTest method shouldFilterUriWithHttpsSchemeAsOutOfScopeByDefault.

@Test
public void shouldFilterUriWithHttpsSchemeAsOutOfScopeByDefault() throws Exception {
    // Given
    URI uri = createUri("https://example.com");
    // When
    FetchStatus status = filter.checkFilter(uri);
    // Then
    assertThat(status, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Example 10 with FetchStatus

use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.

the class DefaultFetchFilterUnitTest method shouldFilterInScopeUriAsValid.

@Test
public void shouldFilterInScopeUriAsValid() throws Exception {
    // Given
    filter.addScopeRegex("example.com");
    URI uri = createUri("http://example.com");
    // When
    FetchStatus status = filter.checkFilter(uri);
    // Then
    assertThat(status, is(equalTo(FetchStatus.VALID)));
}
Also used : URI(org.apache.commons.httpclient.URI) FetchStatus(org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus) Test(org.junit.Test)

Aggregations

URI (org.apache.commons.httpclient.URI)33 FetchStatus (org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus)33 Test (org.junit.Test)31 FetchFilter (org.zaproxy.zap.spider.filters.FetchFilter)2 ArrayList (java.util.ArrayList)1 URIException (org.apache.commons.httpclient.URIException)1