aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/tests
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-10-12 22:52:15 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-10-12 22:52:15 +0200
commitae57359353cf31ff374a8932999742920878bf00 (patch)
tree0db27d394a2a61a5cc94e73014c82954829c1338 /planetwars-server/tests
parented016773b112460ebbf0ff023b0915545229ed41 (diff)
downloadplanetwars.dev-ae57359353cf31ff374a8932999742920878bf00.tar.xz
planetwars.dev-ae57359353cf31ff374a8932999742920878bf00.zip
upgrade to diesel 2.0
Diffstat (limited to 'planetwars-server/tests')
-rw-r--r--planetwars-server/tests/integration.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/planetwars-server/tests/integration.rs b/planetwars-server/tests/integration.rs
index ad63e0e..83de912 100644
--- a/planetwars-server/tests/integration.rs
+++ b/planetwars-server/tests/integration.rs
@@ -27,7 +27,7 @@ fn create_subdir<P: AsRef<Path>>(base_path: &Path, p: P) -> io::Result<String> {
Ok(dir_path_string)
}
-fn clear_database(conn: &PgConnection) {
+fn clear_database(conn: &mut PgConnection) {
diesel::sql_query(
"TRUNCATE TABLE
bots,
@@ -45,20 +45,20 @@ fn clear_database(conn: &PgConnection) {
/// Setup a simple text fixture, having simplebot and the hex map.
/// This is enough to run a simple match.
-fn setup_simple_fixture(db_conn: &PgConnection, config: &GlobalConfig) {
+fn setup_simple_fixture(db_conn: &mut PgConnection, config: &GlobalConfig) {
let bot = db::bots::create_bot(
&db::bots::NewBot {
owner_id: None,
name: "simplebot",
},
- &db_conn,
+ db_conn,
)
.expect("could not create simplebot");
let simplebot_code = std::fs::read_to_string("../simplebot/simplebot.py")
.expect("could not read simplebot code");
let _bot_version =
- modules::bots::save_code_string(&simplebot_code, Some(bot.id), &db_conn, &config)
+ modules::bots::save_code_string(&simplebot_code, Some(bot.id), db_conn, &config)
.expect("could not save bot version");
std::fs::copy(
@@ -71,7 +71,7 @@ fn setup_simple_fixture(db_conn: &PgConnection, config: &GlobalConfig) {
name: "hex",
file_path: "hex.json",
},
- &db_conn,
+ db_conn,
)
.expect("could not save map");
}
@@ -119,14 +119,14 @@ impl<'a> TestApp<'a> {
async fn with_db_conn<F, R>(&self, function: F) -> R
where
- F: FnOnce(&PgConnection) -> R,
+ F: FnOnce(&mut PgConnection) -> R,
{
- let db_conn = self
+ let mut db_conn = self
.db_pool
.get()
.await
.expect("could not get db connection");
- function(&db_conn)
+ function(&mut db_conn)
}
}