use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.
the class DefaultFetchFilterUnitTest method shouldFilterExcludedInScopeUriAsUserRules.
@Test
public void shouldFilterExcludedInScopeUriAsUserRules() throws Exception {
// Given
filter.addScopeRegex("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)));
}
use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.
the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithNoSchemeAsOutOfScope.
@Test
public void shouldFilterUriWithNoSchemeAsOutOfScope() throws Exception {
// Given
URI prefixUri = new URI("http://example.org/", true);
HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
URI uri = new URI("/path", true);
// When
FetchStatus filterStatus = fetchFilter.checkFilter(uri);
// Then
assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.
the class HttpPrefixFetchFilterUnitTest method shouldFilterUriWithDifferentPathAsOutOfScope.
@Test
public void shouldFilterUriWithDifferentPathAsOutOfScope() throws Exception {
// Given
URI prefixUri = new URI("http://example.org/path", true);
HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
URI uri = new URI("http://example.org/not/same/path", true);
// When
FetchStatus filterStatus = fetchFilter.checkFilter(uri);
// Then
assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.
the class HttpPrefixFetchFilterUnitTest method shouldFilterUndefinedUriAsOutOfScope.
@Test
public void shouldFilterUndefinedUriAsOutOfScope() throws Exception {
// Given
URI prefixUri = new URI("http://example.org/", true);
HttpPrefixFetchFilter fetchFilter = new HttpPrefixFetchFilter(prefixUri);
// When
FetchStatus filterStatus = fetchFilter.checkFilter(null);
// Then
assertThat(filterStatus, is(equalTo(FetchStatus.OUT_OF_SCOPE)));
}
use of org.zaproxy.zap.spider.filters.FetchFilter.FetchStatus in project zaproxy by zaproxy.
the class DefaultFetchFilterUnitTest method shouldFilterUriWithNonHttpOrHttpsSchemeAsIllegalProtocol.
@Test
public void shouldFilterUriWithNonHttpOrHttpsSchemeAsIllegalProtocol() throws Exception {
// Given
URI uri = createUri("ftp://example.com");
// When
FetchStatus status = filter.checkFilter(uri);
// Then
assertThat(status, is(equalTo(FetchStatus.ILLEGAL_PROTOCOL)));
}
Aggregations