From 1d042e1bb22a3621d46d07527e316f502753a392 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 11 Jan 2021 12:02:18 +0900 Subject: [PATCH] Add methods to clear data of instances and users table for testing --- plume-models/src/instance.rs | 4 ++++ plume-models/src/users.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plume-models/src/instance.rs b/plume-models/src/instance.rs index a2114915..9e25a6b8 100644 --- a/plume-models/src/instance.rs +++ b/plume-models/src/instance.rs @@ -306,6 +306,10 @@ pub(crate) mod tests { res } + pub(crate) fn clear_instances(conn: &Conn) { + diesel::delete(crate::schema::instances::table).execute(conn).unwrap(); + } + #[test] fn local_instance() { let conn = &db(); diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index c4729acc..2b751e45 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -1171,6 +1171,10 @@ pub(crate) mod tests { vec![admin, user, other] } + pub(crate) fn clear_users(conn: &Conn) { + diesel::delete(crate::schema::users::table).execute(conn).unwrap(); + } + #[test] fn find_by() { let r = rockets();