Example #1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "-u", "--with-users", action="store_true", dest="with_users", default=False
    )
    args = parser.parse_args()
    from inbox.ignition import init_db, main_engine

    maybe_enable_rollbar()

    engine = main_engine(pool_size=1)

    # Always keep the 'alembic_version' table
    keep_tables = ["alembic_version"]
    reset_columns = {}

    # '--with-users' NOT specified
    if not args.with_users:
        keep_tables += [
            "user",
            "namespace",
            "account",
            "imapaccount",
            "user_session",
            "easaccount",
            "folder",
            "gmailaccount",
            "outlookaccount",
            "genericaccount",
            "secret",
            "calendar",
            "easdevice",
        ]

        reset_columns = {"easaccount": ["eas_account_sync_key", "eas_state"]}

    drop_everything(engine, keep_tables=keep_tables, reset_columns=reset_columns)
    # recreate dropped tables
    init_db(engine)
    sys.exit(0)
Example #2
0
 def destroy(self):
     """ Removes all data from the test database. """
     self.session.close()
     drop_everything(self.engine)
Example #3
0
 def destroy(self):
     from inbox.util.db import drop_everything
     from inbox.server.models import engine
     drop_everything(engine, with_users=True)
Example #4
0
    def destroy(self):
        from inbox.util.db import drop_everything

        # Drop test DB
        drop_everything(self.engine, with_users=True)