mirror of
https://github.com/epi052/feroxbuster
synced 2024-07-08 19:45:45 +00:00
added more tests again
This commit is contained in:
parent
88a595fd82
commit
3030296d1c
|
@ -407,7 +407,6 @@ impl HeuristicTests {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use assay::assay;
|
||||
|
||||
#[test]
|
||||
/// request a unique string of 32bytes * a value returns correct result
|
||||
|
@ -419,7 +418,7 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[assay]
|
||||
#[test]
|
||||
/// `detect_directory_listing` correctly identifies tomcat/python instances
|
||||
fn detect_directory_listing_finds_tomcat_python() {
|
||||
let html = "<title>directory listing for /</title>";
|
||||
|
@ -433,7 +432,7 @@ mod tests {
|
|||
));
|
||||
}
|
||||
|
||||
#[assay]
|
||||
#[test]
|
||||
/// `detect_directory_listing` correctly identifies apache instances
|
||||
fn detect_directory_listing_finds_apache() {
|
||||
let html = "<title>index of /</title>";
|
||||
|
@ -444,7 +443,7 @@ mod tests {
|
|||
assert!(matches!(dirlist_type.unwrap(), DirListingType::Apache));
|
||||
}
|
||||
|
||||
#[assay]
|
||||
#[test]
|
||||
/// `detect_directory_listing` correctly identifies ASP.NET instances
|
||||
fn detect_directory_listing_finds_asp_dot_net() {
|
||||
let html = "<title>directory listing -- /</title>";
|
||||
|
@ -455,7 +454,7 @@ mod tests {
|
|||
assert!(matches!(dirlist_type.unwrap(), DirListingType::AspDotNet));
|
||||
}
|
||||
|
||||
#[assay]
|
||||
#[test]
|
||||
/// `detect_directory_listing` returns None when heuristic doesn't match
|
||||
fn detect_directory_listing_returns_none_as_default() {
|
||||
let html = "<title>derp listing -- /</title>";
|
||||
|
|
|
@ -559,3 +559,39 @@ impl FeroxScans {
|
|||
extension_added
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
/// unknown extension should be added to collected_extensions
|
||||
fn unknown_extension_is_added_to_collected_extensions() {
|
||||
let scans = FeroxScans::new(OutputLevel::Default);
|
||||
|
||||
assert_eq!(0, scans.collected_extensions.read().unwrap().len());
|
||||
|
||||
let added = scans.add_discovered_extension(String::from("js"));
|
||||
|
||||
assert!(added);
|
||||
assert_eq!(1, scans.collected_extensions.read().unwrap().len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// known extension should not be added to collected_extensions
|
||||
fn known_extension_is_added_to_collected_extensions() {
|
||||
let scans = FeroxScans::new(OutputLevel::Default);
|
||||
scans
|
||||
.collected_extensions
|
||||
.write()
|
||||
.unwrap()
|
||||
.insert(String::from("js"));
|
||||
|
||||
assert_eq!(1, scans.collected_extensions.read().unwrap().len());
|
||||
|
||||
let added = scans.add_discovered_extension(String::from("js"));
|
||||
|
||||
assert!(!added);
|
||||
assert_eq!(1, scans.collected_extensions.read().unwrap().len());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
mod utils;
|
||||
use assay::assay;
|
||||
use assert_cmd::prelude::*;
|
||||
use httpmock::Method::GET;
|
||||
use httpmock::MockServer;
|
||||
use predicates::prelude::*;
|
||||
use std::env::temp_dir;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use std::{process::Command, time};
|
||||
use utils::{setup_tmp_directory, teardown_tmp_directory};
|
||||
|
||||
|
@ -643,7 +639,7 @@ fn rate_limit_enforced_when_specified() {
|
|||
teardown_tmp_directory(tmp_dir);
|
||||
}
|
||||
|
||||
#[assay]
|
||||
#[test]
|
||||
/// ensure that auto-discovered extensions are tracked in statistics and bar lengths are updated
|
||||
fn add_discovered_extension_updates_bars_and_stats() {
|
||||
let srv = MockServer::start();
|
||||
|
|
Loading…
Reference in New Issue
Block a user