[SQL-CVS] r611 - trunk/SQLObject/sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-02-16 04:30:26
|
Author: ianb Date: 2005-02-16 04:30:22 +0000 (Wed, 16 Feb 2005) New Revision: 611 Added: trunk/SQLObject/sqlobject/tests/test_create_drop.py Log: Explicitly test creation and dropping, including with ifExists and ifNotExists Added: trunk/SQLObject/sqlobject/tests/test_create_drop.py =================================================================== --- trunk/SQLObject/sqlobject/tests/test_create_drop.py 2005-02-16 04:29:41 UTC (rev 610) +++ trunk/SQLObject/sqlobject/tests/test_create_drop.py 2005-02-16 04:30:22 UTC (rev 611) @@ -0,0 +1,29 @@ +from sqlobject import * +from sqlobject.tests.dbtest import * + +class TestCreateDrop(SQLObject): + class sqlmeta(sqlmeta): + idName = 'test_id_here' + table = 'test_create_drop_table' + name = StringCol() + number = IntCol() + time = DateTimeCol() + short = StringCol(length=10) + blobcol = BLOBCol() + + +def test_create_drop(): + conn = getConnection() + TestCreateDrop.setConnection(conn) + TestCreateDrop.dropTable(ifExists=True) + assert not conn.tableExists(TestCreateDrop.sqlmeta.table) + TestCreateDrop.createTable(ifNotExists=True) + assert conn.tableExists(TestCreateDrop.sqlmeta.table) + TestCreateDrop.createTable(ifNotExists=True) + assert conn.tableExists(TestCreateDrop.sqlmeta.table) + TestCreateDrop.dropTable(ifExists=True) + assert not conn.tableExists(TestCreateDrop.sqlmeta.table) + TestCreateDrop.dropTable(ifExists=True) + assert not conn.tableExists(TestCreateDrop.sqlmeta.table) + + |