test: use custom database name and add clean up

This commit is contained in:
Paul Makles
2023-04-22 14:58:55 +01:00
parent 6b10385c0d
commit 750037b5d2
4 changed files with 73 additions and 48 deletions

View File

@@ -12,7 +12,7 @@ use serde::Serialize;
database_derived!(
#[cfg(feature = "mongodb")]
/// MongoDB implementation
pub struct MongoDb(pub ::mongodb::Client);
pub struct MongoDb(pub ::mongodb::Client, pub String);
);
impl Deref for MongoDb {
@@ -27,7 +27,7 @@ impl Deref for MongoDb {
impl MongoDb {
/// Get the Revolt database
pub fn db(&self) -> mongodb::Database {
self.database("revolt")
self.database(&self.1)
}
/// Get a collection by its name