-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathtest_uuidcol.py
More file actions
40 lines (22 loc) · 843 Bytes
/
Copy pathtest_uuidcol.py
File metadata and controls
40 lines (22 loc) · 843 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
from uuid import UUID
from sqlobject import SQLObject, UuidCol
from sqlobject.tests.dbtest import setupClass
########################################
# Uuid columns
########################################
testuuid = UUID('7e3b5c1e-3402-4b10-a3c6-8ee6dbac7d1a')
class UuidContainer(SQLObject):
uuiddata = UuidCol(alternateID=True, default=None)
def test_uuidCol():
setupClass([UuidContainer])
my_uuid = UuidContainer(uuiddata=testuuid)
iid = my_uuid.id
UuidContainer._connection.cache.clear()
my_uuid_2 = UuidContainer.get(iid)
assert my_uuid_2.uuiddata == testuuid
def test_alternate_id():
setupClass([UuidContainer])
UuidContainer(uuiddata=testuuid)
UuidContainer._connection.cache.clear()
my_uuid_2 = UuidContainer.byUuiddata(testuuid)
assert my_uuid_2.uuiddata == testuuid