async fn bail_returns_ok_on_no_active_scans() {
        let (handles, _) = setup_requester_test(None).await;

        let scan_one =
            create_scan(handles.clone(), "http://one", 10, PolicyTrigger::Status403).await;
        let scan_two =
            create_scan(handles.clone(), "http://two", 10, PolicyTrigger::Status429).await;

        scan_one.set_status(ScanStatus::Complete).unwrap();
        scan_two.set_status(ScanStatus::Cancelled).unwrap();

        let scans = handles.ferox_scans().unwrap();
        assert_eq!(scans.get_active_scans().len(), 0);

        let requester = Requester {
            handles,
            seen_links: RwLock::new(HashSet::<String>::new()),
            tuning_lock: Mutex::new(0),
            ferox_scan: Arc::new(FeroxScan::default()),
            target_url: "http://one/one/stuff.php".to_string(),
            rate_limiter: RwLock::new(None),
            policy_data: Default::default(),
        };

        let result = requester.bail(PolicyTrigger::Status403).await;
        assert!(result.is_ok());
    }
/// bail is ok when no active scans are found
bail is ok when no active scans are found
bail is ok when no active scans are found
async fn bail_returns_ok_on_no_active_scans() {
        let (handles, _) = setup_requester_test(None).await;
        let scan_one =
            create_scan(handles.clone(), "http://one", 10, PolicyTrigger::Status403).await;
        let scan_two =
            create_scan(handles.clone(), "http://two", 10, PolicyTrigger::Status429).await;
        scan_one.set_status(ScanStatus::Complete).unwrap();
        scan_two.set_status(ScanStatus::Cancelled).unwrap();
        let scans = handles.ferox_scans().unwrap();
        assert_eq!(scans.get_active_scans().len(), 0);
        let requester = Requester {
            handles,
            seen_links: RwLock::new(HashSet::<String>::new()),
            tuning_lock: Mutex::new(0),
            ferox_scan: Arc::new(FeroxScan::default()),
            target_url: "http://one/one/stuff.php".to_string(),
            rate_limiter: RwLock::new(None),
            policy_data: Default::default(),
        };
        let result = requester.bail(PolicyTrigger::Status403).await;
        assert!(result.is_ok());
    }
async fn bail_returns_ok_on_no_active_scans ( ) { let ( handles , _ ) = setup_requester_test ( None ) . await ; let scan_one = create_scan ( handles . clone ( ) , " " , 10 , PolicyTrigger :: Status403 ) . await ; let scan_two = create_scan ( handles . clone ( ) , " " , 10 , PolicyTrigger :: Status429 ) . await ; scan_one . set_status ( ScanStatus :: Complete ) . unwrap ( ) ; scan_two . set_status ( ScanStatus :: Cancelled ) . unwrap ( ) ; let scans = handles . ferox_scans ( ) . unwrap ( ) ; assert_eq ! ( scans get_active_scans ( ) len ( ) 0 ) ; let requester = Requester { handles , seen_links : RwLock :: new ( HashSet :: < String > :: new ( ) ) , tuning_lock : Mutex :: new ( 0 ) , ferox_scan : Arc :: new ( FeroxScan :: default ( ) ) , target_url : " " . to_string ( ) , rate_limiter : RwLock :: new ( None ) , policy_data : Default :: default ( ) , } ; let result = requester . bail ( PolicyTrigger :: Status403 ) . await ; assert ! ( result is_ok ( ) ) ; }
bail is ok when no active scans are found
bail is ok when no active scans are found