Пример #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()
Пример #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)))
Пример #3
0
def wipe_db_path(path, keep_beds):
    conn = sqlite3.connect(path)
    wipe_db(conn, keep_beds)
Пример #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)
Пример #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]))