Example #1
0
 def wipe_close_and_reconnect(self,
                              keep_beds=False,
                              reset_admin=False,
                              admin_email=None,
                              admin_pass=None):
     wipe_db(self.store, keep_beds, reset_admin, admin_email, admin_pass)
     self.store._session.close()
     self.store = self.store_factory.create()
Example #2
0
 def test_wipe(self):
   with self.engine.connect() as conn:
     wipe_db(conn.connection, keep_beds=False)
     users = list(self.store.get_users())
     self.assertItemsEqual([user.name for user in users],
                           itertools.repeat("Jean Dumont", len(users)))
     self.assertItemsEqual([
       user.email for user in users
     ], itertools.repeat("*****@*****.**", len(users)))
     bed_counts = list(self.store.get_bed_counts(None))
     self.assertItemsEqual([bc.n_covid_free for bc in bed_counts],
                           itertools.repeat(2, len(bed_counts)))
Example #3
0
def wipe_db_path(path, keep_beds):
    conn = sqlite3.connect(path)
    wipe_db(conn, keep_beds)
Example #4
0
def wipe_db_path(path, keep_beds, reset_admin, admin_email, admin_pass):
    store_factory = StoreFactory(create_engine("sqlite:///" + path))
    wipe_db(store_factory.create(), keep_beds, reset_admin, admin_email,
            admin_pass)
Example #5
0
 def test_keep_beds(self):
   with self.engine.connect() as conn:
     wipe_db(conn.connection, keep_beds=True)
     bed_counts = list(self.store.get_bed_counts(None))
     self.assertFalse(all([bc.n_covid_free == 2 for bc in bed_counts]))