-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathtest_create_drop.py
More file actions
29 lines (25 loc) · 1.03 KB
/
test_create_drop.py
File metadata and controls
29 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from sqlobject import BLOBCol, DateTimeCol, IntCol, SQLObject, StringCol, \
sqlmeta
from sqlobject.tests.dbtest import getConnection
class SOTestCreateDrop(SQLObject):
class sqlmeta(sqlmeta):
idName = 'test_id_here'
table = 'test_create_drop_table'
name = StringCol()
number = IntCol()
so_time = DateTimeCol()
short = StringCol(length=10)
blobcol = BLOBCol()
def test_create_drop():
conn = getConnection()
SOTestCreateDrop.setConnection(conn)
SOTestCreateDrop.dropTable(ifExists=True)
assert not conn.tableExists(SOTestCreateDrop.sqlmeta.table)
SOTestCreateDrop.createTable(ifNotExists=True)
assert conn.tableExists(SOTestCreateDrop.sqlmeta.table)
SOTestCreateDrop.createTable(ifNotExists=True)
assert conn.tableExists(SOTestCreateDrop.sqlmeta.table)
SOTestCreateDrop.dropTable(ifExists=True)
assert not conn.tableExists(SOTestCreateDrop.sqlmeta.table)
SOTestCreateDrop.dropTable(ifExists=True)
assert not conn.tableExists(SOTestCreateDrop.sqlmeta.table)