Browse Source

Make tests compile again

pull/813/head
Ana Gelez 3 months ago
parent
commit
8aa4ae4302
Signed by: igalic <me+github@igalic.co> GPG Key ID: ACFEFF7F6A123A86
5 changed files with 8 additions and 1 deletions
  1. BIN
      plume-models/plume.db-journal
  2. BIN
      plume-models/plume_tests.sqlite-journal
  3. +3
    -0
      plume-models/src/lib.rs
  4. +4
    -0
      plume-models/src/plume_rocket.rs
  5. +1
    -1
      plume-models/src/search/mod.rs

BIN
plume-models/plume.db-journal View File


BIN
plume-models/plume_tests.sqlite-journal View File


+ 3
- 0
plume-models/src/lib.rs View File

@@ -330,6 +330,9 @@ mod tests {
searcher: Arc::new(search::tests::get_searcher(&CONFIG.search_tokenizers)),
worker: Arc::new(ScheduledThreadPool::new(2)),
user: None,
actors: Arc::new(
riker::actors::ActorSystem::new().expect("Couldn't create test actor system"),
),
}
}
}


+ 4
- 0
plume-models/src/plume_rocket.rs View File

@@ -49,6 +49,7 @@ mod module {
#[cfg(test)]
mod module {
use crate::{db_conn::DbConn, search, users};
use riker::actors::ActorSystem;
use rocket::{
request::{self, FromRequest, Request},
Outcome, State,
@@ -62,6 +63,7 @@ mod module {
pub user: Option<users::User>,
pub searcher: Arc<search::Searcher>,
pub worker: Arc<ScheduledThreadPool>,
pub actors: Arc<ActorSystem>,
}

impl<'a, 'r> FromRequest<'a, 'r> for PlumeRocket {
@@ -72,11 +74,13 @@ mod module {
let user = request.guard::<users::User>().succeeded();
let worker = request.guard::<'_, State<'_, Arc<ScheduledThreadPool>>>()?;
let searcher = request.guard::<'_, State<'_, Arc<search::Searcher>>>()?;
let actors = request.guard::<'_, State<'_, Arc<ActorSystem>>>()?;
Outcome::Success(PlumeRocket {
conn,
user,
worker: worker.clone(),
searcher: searcher.clone(),
actors: actors.clone(),
})
}
}


+ 1
- 1
plume-models/src/search/mod.rs View File

@@ -165,7 +165,7 @@ pub(crate) mod tests {

let newtitle = random_hex()[..8].to_owned();
post.title = newtitle.clone();
post.update(conn, &searcher).unwrap();
post.update(conn).unwrap();
searcher.commit();
assert_eq!(
searcher.search_document(Query::from_str(&newtitle).unwrap(), (0, 1))[0].id,


Loading…
Cancel
Save