fn deny_list_works_during_recursion() {
    let srv = MockServer::start();
    let urls = [
        "js".to_string(),
        "prod".to_string(),
        "dev".to_string(),
        "file.js".to_string(),
    ];
    let (tmp_dir, file) = setup_tmp_directory(&urls, "wordlist").unwrap();

    let js_mock = srv.mock(|when, then| {
        when.method(GET).path("/js");
        then.status(301).header("Location", &srv.url("/js/"));
    });

    let js_prod_mock = srv.mock(|when, then| {
        when.method(GET).path("/js/prod");
        then.status(301).header("Location", &srv.url("/js/prod/"));
    });

    let js_dev_mock = srv.mock(|when, then| {
        when.method(GET).path("/js/dev");
        then.status(301).header("Location", &srv.url("/js/dev/"));
    });

    let js_dev_file_mock = srv.mock(|when, then| {
        when.method(GET).path("/js/dev/file.js");
        then.status(200)
            .body("this is a test and is more bytes than other ones");
    });

    let cmd = Command::cargo_bin("feroxbuster")
        .unwrap()
        .arg("--url")
        .arg(srv.url("/"))
        .arg("--wordlist")
        .arg(file.as_os_str())
        .arg("-t")
        .arg("1")
        .arg("--dont-scan")
        .arg(srv.url("/js/dev"))
        .unwrap();

    cmd.assert().success().stdout(
        predicate::str::is_match("301.*js")
            .unwrap()
            .and(predicate::str::is_match("301.*js/prod").unwrap())
            .and(predicate::str::is_match("301.*js/dev").unwrap())
            .not()
            .and(predicate::str::is_match("200.*js/dev/file.js").unwrap())
            .not(),
    );

    assert_eq!(js_mock.hits(), 1);
    assert_eq!(js_prod_mock.hits(), 1);
    assert_eq!(js_dev_mock.hits(), 0);
    assert_eq!(js_dev_file_mock.hits(), 0);

    teardown_tmp_directory(tmp_dir);
}
/// test that the deny list prevents requests of urls found during recursion
test that the deny list prevents requests of urls found during recursion
test that the deny list prevents requests of urls found during recursion
fn deny_list_works_during_recursion() {
    let srv = MockServer::start();
    let urls = [
        "js".to_string(),
        "prod".to_string(),
        "dev".to_string(),
        "file.js".to_string(),
    ];
    let (tmp_dir, file) = setup_tmp_directory(&urls, "wordlist").unwrap();
    let js_mock = srv.mock(|when, then| {
        when.method(GET).path("/js");
        then.status(301).header("Location", &srv.url("/js/"));
    });
    let js_prod_mock = srv.mock(|when, then| {
        when.method(GET).path("/js/prod");
        then.status(301).header("Location", &srv.url("/js/prod/"));
    });
    let js_dev_mock = srv.mock(|when, then| {
        when.method(GET).path("/js/dev");
        then.status(301).header("Location", &srv.url("/js/dev/"));
    });
    let js_dev_file_mock = srv.mock(|when, then| {
        when.method(GET).path("/js/dev/file.js");
        then.status(200)
            .body("this is a test and is more bytes than other ones");
    });
    let cmd = Command::cargo_bin("feroxbuster")
        .unwrap()
        .arg("--url")
        .arg(srv.url("/"))
        .arg("--wordlist")
        .arg(file.as_os_str())
        .arg("-t")
        .arg("1")
        .arg("--dont-scan")
        .arg(srv.url("/js/dev"))
        .unwrap();
    cmd.assert().success().stdout(
        predicate::str::is_match("301.*js")
            .unwrap()
            .and(predicate::str::is_match("301.*js/prod").unwrap())
            .and(predicate::str::is_match("301.*js/dev").unwrap())
            .not()
            .and(predicate::str::is_match("200.*js/dev/file.js").unwrap())
            .not(),
    );
    assert_eq!(js_mock.hits(), 1);
    assert_eq!(js_prod_mock.hits(), 1);
    assert_eq!(js_dev_mock.hits(), 0);
    assert_eq!(js_dev_file_mock.hits(), 0);
    teardown_tmp_directory(tmp_dir);
}
fn deny_list_works_during_recursion ( ) { let srv = MockServer :: start ( ) ; let urls = [ " " . to_string ( ) , " " . to_string ( ) , " " . to_string ( ) , " " . to_string ( ) , ] ; let ( tmp_dir , file ) = setup_tmp_directory ( & urls , " " ) . unwrap ( ) ; let js_mock = srv . mock ( | when , then | { when . method ( GET ) . path ( " " ) ; then . status ( 301 ) . header ( " " , & srv . url ( " " ) ) ; } ) ; let js_prod_mock = srv . mock ( | when , then | { when . method ( GET ) . path ( " " ) ; then . status ( 301 ) . header ( " " , & srv . url ( " " ) ) ; } ) ; let js_dev_mock = srv . mock ( | when , then | { when . method ( GET ) . path ( " " ) ; then . status ( 301 ) . header ( " " , & srv . url ( " " ) ) ; } ) ; let js_dev_file_mock = srv . mock ( | when , then | { when . method ( GET ) . path ( " " ) ; then . status ( 200 ) . body ( " " ) ; } ) ; let cmd = Command :: cargo_bin ( " " ) . unwrap ( ) . arg ( " " ) . arg ( srv . url ( " " ) ) . arg ( " " ) . arg ( file . as_os_str ( ) ) . arg ( " " ) . arg ( " " ) . arg ( " " ) . arg ( srv . url ( " " ) ) . unwrap ( ) ; cmd . assert ( ) . success ( ) . stdout ( predicate :: str :: is_match ( " " ) . unwrap ( ) . and ( predicate :: str :: is_match ( " " ) . unwrap ( ) ) . and ( predicate :: str :: is_match ( " " ) . unwrap ( ) ) . not ( ) . and ( predicate :: str :: is_match ( " " ) . unwrap ( ) ) . not ( ) , ) ; assert_eq ! ( js_mock hits ( ) 1 ) ; assert_eq ! ( js_prod_mock hits ( ) 1 ) ; assert_eq ! ( js_dev_mock hits ( ) 0 ) ; assert_eq ! ( js_dev_file_mock hits ( ) 0 ) ; teardown_tmp_directory ( tmp_dir ) ; }
test that the deny list prevents requests of urls found during recursion
test that the deny list prevents requests of urls found during recursion