From dbf36ddf0585f9e07eedb195d047dc518173b032 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Sun, 24 Jan 2021 23:12:44 +0900 Subject: [PATCH] Cache fetched instance --- src/routes/blogs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 31c5c6ea..e87ce457 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -422,7 +422,7 @@ mod tests { fn create_models(conn: &DbConn) -> (Instance, User, Blog, Post) { conn.transaction::<(Instance, User, Blog, Post), diesel::result::Error, _>(|| { let instance = Instance::get_local().unwrap_or_else(|_| { - Instance::insert( + let instance = Instance::insert( conn, NewInstance { default_license: "CC-0-BY-SA".to_string(), @@ -436,7 +436,9 @@ mod tests { public_domain: random_hex().to_string(), }, ) - .unwrap() + .unwrap(); + Instance::cache_local(conn); + instance }); let mut user = NewUser::default(); user.instance_id = instance.id;