summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-04-01 10:54:28 -0500
committertom barrett <spalf0@gmail.com>2019-04-01 10:54:28 -0500
commit810c77ba30c65215c2d5e4b6f8a73f3b73e2b152 (patch)
tree3666053d51c598f701733231244104f536a4d24a /tests
parent95b3508d2397b64c7c63bd3586e524998f194e36 (diff)
database backup and restore
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.rs17
1 files changed, 16 insertions, 1 deletions
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::<MassEntry>(&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");