mirror of
https://github.com/chatmail/core.git
synced 2026-04-25 01:16:29 +03:00
Refactor context creation to a builder pattern
This mainly refactors context creation to use a builder pattern. It also adds a logdir option to this builder patter but doesn't yet use this.
This commit is contained in:
@@ -7,7 +7,7 @@ use tempfile::{tempdir, TempDir};
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::constants::KeyType;
|
||||
use crate::context::{Context, ContextCallback};
|
||||
use crate::context::{Context, ContextBuilder, ContextCallback};
|
||||
use crate::events::Event;
|
||||
use crate::key;
|
||||
|
||||
@@ -33,7 +33,9 @@ pub fn test_context(callback: Option<Box<ContextCallback>>) -> TestContext {
|
||||
Some(cb) => cb,
|
||||
None => Box::new(|_, _| 0),
|
||||
};
|
||||
let ctx = Context::new(cb, "FakeOs".into(), dbfile).unwrap();
|
||||
let ctx = ContextBuilder::new(cb, "FakeOs".into(), dbfile)
|
||||
.create()
|
||||
.unwrap();
|
||||
TestContext { ctx: ctx, dir: dir }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user