aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/http_downloader.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/util/http_downloader.rs')
-rw-r--r--crates/shirabe/src/util/http_downloader.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/shirabe/src/util/http_downloader.rs b/crates/shirabe/src/util/http_downloader.rs
index edc84cc..782f04a 100644
--- a/crates/shirabe/src/util/http_downloader.rs
+++ b/crates/shirabe/src/util/http_downloader.rs
@@ -883,6 +883,30 @@ impl HttpDownloader {
&& function_exists("curl_multi_init")
}
+ /// For testing only. Builds an HttpDownloader whose request methods are fully
+ /// short-circuited by the mock (see [`HttpDownloader::__expects`]), without
+ /// constructing the real curl/rfs backends. Mirrors HttpDownloaderMock, which
+ /// extends HttpDownloader but never performs curl I/O.
+ pub fn __new_mock(
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ ) -> Self {
+ Self {
+ io,
+ config,
+ jobs: IndexMap::new(),
+ options: IndexMap::new(),
+ running_jobs: 0,
+ max_jobs: 12,
+ curl: None,
+ rfs: None,
+ id_gen: 0,
+ disabled: false,
+ allow_async: false,
+ mock: None,
+ }
+ }
+
/// For testing only. Mirrors HttpDownloaderMock::expects: installs the expectation queue,
/// strict flag and default handler used by the mock request path.
pub fn __expects(