mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-07 12:20:34 +08:00
cli: Improve test utilities
This will allow easy creation of multiple users with deterministic keys. Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
@@ -70,6 +70,16 @@ impl TestFormula {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn envs<K: ToString, V: ToString>(
|
||||
&mut self,
|
||||
envs: impl IntoIterator<Item = (K, V)>,
|
||||
) -> &mut Self {
|
||||
for (k, v) in envs {
|
||||
self.env.insert(k.to_string(), v.to_string());
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn file(&mut self, path: impl AsRef<Path>) -> Result<&mut Self, Error> {
|
||||
let contents = fs::read(path)?;
|
||||
self.read(io::Cursor::new(contents))
|
||||
|
||||
Reference in New Issue
Block a user