Search in sources :

Example 31 with FetchStatus

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

the class DefaultFetchFilterUnitTest method shouldFilterUriWithNonSchemeAsIllegalProtocol.

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

Example 32 with FetchStatus

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

the class DefaultFetchFilterUnitTest method shouldFilterExcludedAlwaysInScopeUriAsUserRules.

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

Example 33 with FetchStatus

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

the class DefaultFetchFilterUnitTest method shouldFilterUriWithHttpSchemeAsOutOfScopeByDefault.

@Test
public void shouldFilterUriWithHttpSchemeAsOutOfScopeByDefault() throws Exception {
    // Given
    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)

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