def test_database_creation(self):
        """Check, if :meth:rethinkmodel.manage.check_db() creates the database."""
        db_name = "test_creation"
        config(dbname=db_name)
        check_db()

        rdb = RethinkDB()
        conn = rdb.connect()
        dbs = rdb.db_list().run(conn)
        if db_name not in dbs:
            self.fail("Database named {db_name} was not created")
        conn.close()
Beispiel #2
0
def clean(dbname: str):
    """Test utils, clean database to recreate it."""
    db.DB_NAME = dbname
    config(dbname=dbname)
    rdb, conn = connect()
    try:
        rdb.db_drop(dbname).run(conn)
    except errors.ReqlOpFailedError:
        pass

    rdb.db_create(dbname).run(conn)
    conn.close()
Beispiel #3
0
 def setUp(self) -> None:
     """Use soft deletion."""
     config(dbname=DB_NAME, soft_delete=True)
     return super().setUp()
Beispiel #4
0
 def setUp(self) -> None:
     """Manage table."""
     config(dbname=DB_NAME)
     manage(__name__)
     return super().setUp()
Beispiel #5
0
 def setUp(self) -> None:
     """Set up database and table creation."""
     config(dbname=DB_NAME)
     manage(__name__)
     return super().setUp()
 def setUp(self) -> None:
     """Make the connection in soft delet mode."""
     config(dbname=DB_NAME, soft_delete=True)
     manage(__name__)
     return super().setUp()
Beispiel #7
0
 def setUp(self) -> None:
     """Confugure database."""
     config(dbname="test_manage")
     return super().setUp()
Beispiel #8
0
 def setUp(self) -> None:
     """Configure DB and create tables."""
     config(dbname="tests_one_to_many")
     manage(__name__)
     return super().setUp()
Beispiel #9
0
 def setUp(self) -> None:
     """Configure database and create tables."""
     config(dbname="test_generic")
     manage(__name__)
     return super().setUp()