forked from mirrors/kingfisher
Fixed test
This commit is contained in:
parent
828ebf6d25
commit
89ce645d14
2 changed files with 23 additions and 26 deletions
|
|
@ -109,7 +109,7 @@ fn normalize_repo_identifier(parts: &[String]) -> Option<String> {
|
|||
}
|
||||
|
||||
fn parse_repo_identifier_from_path(path: &str) -> Option<String> {
|
||||
let mut segments: Vec<String> = path
|
||||
let segments: Vec<String> = path
|
||||
.trim_matches('/')
|
||||
.split('/')
|
||||
.filter(|s| !s.is_empty())
|
||||
|
|
|
|||
|
|
@ -126,31 +126,6 @@ fn build_git_urls(
|
|||
(repository_url, commit_url, file_url)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::build_git_urls;
|
||||
|
||||
#[test]
|
||||
fn azure_commit_links_use_query_paths() {
|
||||
let (repo_url, commit_url, file_url) = build_git_urls(
|
||||
"https://dev.azure.com/org/project/_git/repo",
|
||||
"0123456789abcdef",
|
||||
"dir/file.txt",
|
||||
7,
|
||||
);
|
||||
|
||||
assert_eq!(repo_url, "https://dev.azure.com/org/project/_git/repo");
|
||||
assert_eq!(
|
||||
commit_url,
|
||||
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef"
|
||||
);
|
||||
assert_eq!(
|
||||
file_url,
|
||||
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef?path=/dir/file.txt&line=7"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(
|
||||
global_args: &GlobalArgs,
|
||||
ds: Arc<Mutex<findings_store::FindingsStore>>,
|
||||
|
|
@ -902,6 +877,28 @@ mod tests {
|
|||
.unwrap();
|
||||
assert_eq!(git_file_path, "path/in/history.txt");
|
||||
}
|
||||
|
||||
use super::build_git_urls;
|
||||
|
||||
#[test]
|
||||
fn azure_commit_links_use_query_paths() {
|
||||
let (repo_url, commit_url, file_url) = build_git_urls(
|
||||
"https://dev.azure.com/org/project/_git/repo",
|
||||
"0123456789abcdef",
|
||||
"dir/file.txt",
|
||||
7,
|
||||
);
|
||||
|
||||
assert_eq!(repo_url, "https://dev.azure.com/org/project/_git/repo");
|
||||
assert_eq!(
|
||||
commit_url,
|
||||
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef"
|
||||
);
|
||||
assert_eq!(
|
||||
file_url,
|
||||
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef?path=/dir/file.txt&line=7"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
impl From<finding_data::FindingDataEntry> for ReportMatch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue