From 810c77ba30c65215c2d5e4b6f8a73f3b73e2b152 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Mon, 1 Apr 2019 10:54:28 -0500 Subject: database backup and restore --- tests/tests.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/tests.rs b/tests/tests.rs index 7d7449c..4c5c96b 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -535,7 +535,8 @@ mod tests { .len(); let name = String::from("test"); - let mass = Mass::new_astroid(); + let mut mass = Mass::new_astroid(); + diesel::insert_into(db_masses) .values(&mass.to_mass_entry(name.clone())) .execute(&connection) @@ -555,6 +556,20 @@ mod tests { assert!(mass.position.x == db_mass[0].to_mass().1.position.x); + mass.process(&mut HashMap::new()); + + diesel::update(db_masses) + .set(mass.to_mass_entry(name.clone())) + .execute(&connection) + .expect("Cannot update"); + + let db_mass = db_masses + .filter(dsl::name.eq(name.clone())) + .load::(&connection) + .expect("Cannot filter"); + + assert!(mass.position.x == db_mass[0].to_mass().1.position.x); + diesel::delete(db_masses.filter(dsl::name.eq(name))) .execute(&connection) .expect("Cannot delete"); -- cgit v1.2.3