Updated tests to reflect API changes
This commit is contained in:
parent
65d0eab793
commit
322ab41b8c
2 changed files with 20 additions and 30 deletions
|
@ -70,18 +70,18 @@ fn test_walk_and_embed_assets() {
|
||||||
let opt_no_js: bool = false;
|
let opt_no_js: bool = false;
|
||||||
let opt_no_images: bool = false;
|
let opt_no_images: bool = false;
|
||||||
let opt_silent = true;
|
let opt_silent = true;
|
||||||
let opt_insecure = false;
|
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
walk_and_embed_assets(
|
walk_and_embed_assets(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
&url,
|
&url,
|
||||||
&dom.document,
|
&dom.document,
|
||||||
opt_no_css,
|
opt_no_css,
|
||||||
opt_no_js,
|
opt_no_js,
|
||||||
opt_no_images,
|
opt_no_images,
|
||||||
"",
|
|
||||||
opt_silent,
|
opt_silent,
|
||||||
opt_insecure,
|
|
||||||
opt_no_frames,
|
opt_no_frames,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -106,18 +106,18 @@ fn test_walk_and_embed_assets_ensure_no_recursive_iframe() {
|
||||||
let opt_no_js: bool = false;
|
let opt_no_js: bool = false;
|
||||||
let opt_no_images: bool = false;
|
let opt_no_images: bool = false;
|
||||||
let opt_silent = true;
|
let opt_silent = true;
|
||||||
let opt_insecure = false;
|
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
walk_and_embed_assets(
|
walk_and_embed_assets(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
&url,
|
&url,
|
||||||
&dom.document,
|
&dom.document,
|
||||||
opt_no_css,
|
opt_no_css,
|
||||||
opt_no_js,
|
opt_no_js,
|
||||||
opt_no_images,
|
opt_no_images,
|
||||||
"",
|
|
||||||
opt_silent,
|
opt_silent,
|
||||||
opt_insecure,
|
|
||||||
opt_no_frames,
|
opt_no_frames,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -144,18 +144,17 @@ fn test_walk_and_embed_assets_no_css() {
|
||||||
let opt_no_js: bool = false;
|
let opt_no_js: bool = false;
|
||||||
let opt_no_images: bool = false;
|
let opt_no_images: bool = false;
|
||||||
let opt_silent = true;
|
let opt_silent = true;
|
||||||
let opt_insecure = false;
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
walk_and_embed_assets(
|
walk_and_embed_assets(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
&url,
|
&url,
|
||||||
&dom.document,
|
&dom.document,
|
||||||
opt_no_css,
|
opt_no_css,
|
||||||
opt_no_js,
|
opt_no_js,
|
||||||
opt_no_images,
|
opt_no_images,
|
||||||
"",
|
|
||||||
opt_silent,
|
opt_silent,
|
||||||
opt_insecure,
|
|
||||||
opt_no_frames,
|
opt_no_frames,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -189,18 +188,18 @@ fn test_walk_and_embed_assets_no_images() {
|
||||||
let opt_no_js: bool = false;
|
let opt_no_js: bool = false;
|
||||||
let opt_no_images: bool = true;
|
let opt_no_images: bool = true;
|
||||||
let opt_silent = true;
|
let opt_silent = true;
|
||||||
let opt_insecure = false;
|
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
walk_and_embed_assets(
|
walk_and_embed_assets(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
&url,
|
&url,
|
||||||
&dom.document,
|
&dom.document,
|
||||||
opt_no_css,
|
opt_no_css,
|
||||||
opt_no_js,
|
opt_no_js,
|
||||||
opt_no_images,
|
opt_no_images,
|
||||||
"",
|
|
||||||
opt_silent,
|
opt_silent,
|
||||||
opt_insecure,
|
|
||||||
opt_no_frames,
|
opt_no_frames,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -236,18 +235,17 @@ fn test_walk_and_embed_assets_no_frames() {
|
||||||
let opt_no_js: bool = false;
|
let opt_no_js: bool = false;
|
||||||
let opt_no_images: bool = false;
|
let opt_no_images: bool = false;
|
||||||
let opt_silent = true;
|
let opt_silent = true;
|
||||||
let opt_insecure = false;
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
walk_and_embed_assets(
|
walk_and_embed_assets(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
&url,
|
&url,
|
||||||
&dom.document,
|
&dom.document,
|
||||||
opt_no_css,
|
opt_no_css,
|
||||||
opt_no_js,
|
opt_no_js,
|
||||||
opt_no_images,
|
opt_no_images,
|
||||||
"",
|
|
||||||
opt_silent,
|
opt_silent,
|
||||||
opt_insecure,
|
|
||||||
opt_no_frames,
|
opt_no_frames,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -275,18 +273,18 @@ fn test_walk_and_embed_assets_no_js() {
|
||||||
let opt_no_js: bool = true;
|
let opt_no_js: bool = true;
|
||||||
let opt_no_images: bool = false;
|
let opt_no_images: bool = false;
|
||||||
let opt_silent = true;
|
let opt_silent = true;
|
||||||
let opt_insecure = false;
|
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
walk_and_embed_assets(
|
walk_and_embed_assets(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
&url,
|
&url,
|
||||||
&dom.document,
|
&dom.document,
|
||||||
opt_no_css,
|
opt_no_css,
|
||||||
opt_no_js,
|
opt_no_js,
|
||||||
opt_no_images,
|
opt_no_images,
|
||||||
"",
|
|
||||||
opt_silent,
|
opt_silent,
|
||||||
opt_insecure,
|
|
||||||
opt_no_frames,
|
opt_no_frames,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -3,26 +3,18 @@ use std::collections::HashMap;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_retrieve_asset() {
|
fn test_retrieve_asset() {
|
||||||
let cache = &mut HashMap::new();
|
let cache = &mut HashMap::new();
|
||||||
let (data, final_url) = retrieve_asset(
|
let client = reqwest::Client::new();
|
||||||
cache,
|
let (data, final_url) =
|
||||||
"data:text/html;base64,...",
|
retrieve_asset(cache, &client, "data:text/html;base64,...", true, "", false).unwrap();
|
||||||
true,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(&data, "data:text/html;base64,...");
|
assert_eq!(&data, "data:text/html;base64,...");
|
||||||
assert_eq!(&final_url, "data:text/html;base64,...");
|
assert_eq!(&final_url, "data:text/html;base64,...");
|
||||||
|
|
||||||
let (data, final_url) = retrieve_asset(
|
let (data, final_url) = retrieve_asset(
|
||||||
cache,
|
cache,
|
||||||
|
&client,
|
||||||
"data:text/html;base64,...",
|
"data:text/html;base64,...",
|
||||||
true,
|
true,
|
||||||
"image/png",
|
"image/png",
|
||||||
"",
|
|
||||||
true,
|
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue