async fn request_link_bails_on_seen_url() -> Result<()> {
    let url = "/unique-for-this-test.php";
    let srv = MockServer::start();
    let served = srv.url(url);

    let mock = srv.mock(|when, then| {
        when.method(GET).path(url);
        then.status(200)
            .body("this is a unique test, don't reuse the endpoint");
    });

    let scans = Arc::new(FeroxScans::default());
    scans.add_file_scan(&served, ScanOrder::Latest);

    let robots = setup_extractor(ExtractionTarget::RobotsTxt, scans.clone());
    let body = setup_extractor(ExtractionTarget::ResponseBody, scans);

    let r_resp = robots.request_link(&served).await;
    let b_resp = body.request_link(&served).await;

    assert!(r_resp.is_err());
    assert!(b_resp.is_err());
    assert_eq!(mock.hits(), 0); // function exits before requests can happen
    Ok(())
}
/// request_link should bail in the event that the url is already in scanned_urls
request_link should bail in the event that the url is already in scanned_urls
request_link should bail in the event that the url is already in scanned_urls
async fn request_link_bails_on_seen_url() -> Result<()> {
    let url = "/unique-for-this-test.php";
    let srv = MockServer::start();
    let served = srv.url(url);
    let mock = srv.mock(|when, then| {
        when.method(GET).path(url);
        then.status(200)
            .body("this is a unique test, don't reuse the endpoint");
    });
    let scans = Arc::new(FeroxScans::default());
    scans.add_file_scan(&served, ScanOrder::Latest);
    let robots = setup_extractor(ExtractionTarget::RobotsTxt, scans.clone());
    let body = setup_extractor(ExtractionTarget::ResponseBody, scans);
    let r_resp = robots.request_link(&served).await;
    let b_resp = body.request_link(&served).await;
    assert!(r_resp.is_err());
    assert!(b_resp.is_err());
    assert_eq!(mock.hits(), 0); // function exits before requests can happen
    Ok(())
}
async fn request_link_bails_on_seen_url ( ) -> Result < ( ) > { let url = " " ; let srv = MockServer :: start ( ) ; let served = srv . url ( url ) ; let mock = srv . mock ( | when , then | { when . method ( GET ) . path ( url ) ; then . status ( 200 ) . body ( " " ) ; } ) ; let scans = Arc :: new ( FeroxScans :: default ( ) ) ; scans . add_file_scan ( & served , ScanOrder :: Latest ) ; let robots = setup_extractor ( ExtractionTarget :: RobotsTxt , scans . clone ( ) ) ; let body = setup_extractor ( ExtractionTarget :: ResponseBody , scans ) ; let r_resp = robots . request_link ( & served ) . await ; let b_resp = body . request_link ( & served ) . await ; assert ! ( r_resp is_err ( ) ) ; assert ! ( b_resp is_err ( ) ) ; assert_eq ! ( mock hits ( ) 0 ) ; // function exits before requests can happen Ok ( ( ) ) }
request_link should bail in the event that the url is already in scanned_urls
request_link should bail in the event that the url is already in scanned_urls