diff options
Diffstat (limited to 'tests/common')
| -rw-r--r-- | tests/common/mod.rs | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 58c6dae..426f44d 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; -use aur_build::config::Config; +use aur_build::config::{Config, TestHooks}; use aur_build::db::{self, Db}; pub struct Env { @@ -127,14 +127,14 @@ impl Env { /// Make the next publish abort at a named point (I4 / I5 tests). pub fn set_publish_fault(&mut self, at: &str) { - self.cfg.publish_fault = Some(at.to_string()); + self.cfg.hooks.publish_fault = Some(at.to_string()); } pub fn clear_publish_fault(&mut self) { - self.cfg.publish_fault = None; + self.cfg.hooks.publish_fault = None; } /// Make the named shim fail (the "build failed" path, ยง8.4). pub fn set_shim_fail(&mut self, tool: &str) { - self.cfg.shim_fail = Some(tool.to_string()); + self.cfg.hooks.shim_fail = Some(tool.to_string()); } pub fn query_i64(&self, sql: &str, params: &[P]) -> Option<i64> { @@ -236,12 +236,15 @@ pub fn env_with_fixture(name: &str) -> (Env, Fixture) { let cfg = Config { root: tmp.path().to_path_buf(), signing_key_id: "TESTKEY".into(), - path_prepend: Some(shim_dir()), - shim_manifest: Some(fx.manifest.clone()), - shim_dir: Some(tmp.path().join("shimlog")), + hooks: TestHooks { + path_prepend: Some(shim_dir()), + shim_manifest: Some(fx.manifest.clone()), + shim_dir: Some(tmp.path().join("shimlog")), + ..TestHooks::default() + }, ..Config::default() }; - std::fs::create_dir_all(cfg.shim_dir.as_ref().unwrap()).unwrap(); + std::fs::create_dir_all(cfg.hooks.shim_dir.as_ref().unwrap()).unwrap(); cfg.ensure_dirs().unwrap(); let env = Env::with_cfg(tmp, cfg); env.subscribe(name); @@ -258,12 +261,15 @@ pub fn env_with_two_fixtures(a: &str, b: &str) -> (Env, Fixture, Fixture) { let cfg = Config { root: tmp.path().to_path_buf(), signing_key_id: "TESTKEY".into(), - path_prepend: Some(shim_dir()), - shim_manifest: Some(fb.manifest.clone()), - shim_dir: Some(tmp.path().join("shimlog")), + hooks: TestHooks { + path_prepend: Some(shim_dir()), + shim_manifest: Some(fb.manifest.clone()), + shim_dir: Some(tmp.path().join("shimlog")), + ..TestHooks::default() + }, ..Config::default() }; - std::fs::create_dir_all(cfg.shim_dir.as_ref().unwrap()).unwrap(); + std::fs::create_dir_all(cfg.hooks.shim_dir.as_ref().unwrap()).unwrap(); cfg.ensure_dirs().unwrap(); let env = Env::with_cfg(tmp, cfg); env.subscribe(a); |
