[SQL-CVS] SQLObject/tests test.py,1.22,1.23
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-09-07 07:05:30
|
Update of /cvsroot/sqlobject/SQLObject/tests In directory sc8-pr-cvs1:/tmp/cvs-serv10132/tests Modified Files: test.py Log Message: Added expire and sync methods Index: test.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/tests/test.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test.py 7 Sep 2003 00:49:03 -0000 1.22 --- test.py 7 Sep 2003 07:05:26 -0000 1.23 *************** *** 18,23 **** class TestSO1(SQLObject): ! name = StringCol(length=10) ! _columns = [ StringCol('passwd', length=10), --- 18,23 ---- class TestSO1(SQLObject): ! name = StringCol(length=50) ! _cacheValues = False _columns = [ StringCol('passwd', length=10), *************** *** 44,47 **** --- 44,54 ---- self.assertEqual(bob.passwd, 'god'.encode('rot13')) + def testNewline(self): + bob = self.MyClass.selectBy(name='bob')[0] + testString = 'hey\nyou\\can\'t you see me?\t' + bob.name = testString + self.assertEqual(bob.name, testString) + + class TestCaseGetSet(TestCase1): *************** *** 54,58 **** class TestSO2(SQLObject): ! name = StringCol(length=10) passwd = StringCol(length=10) --- 61,65 ---- class TestSO2(SQLObject): ! name = StringCol(length=50) passwd = StringCol(length=10) *************** *** 581,584 **** --- 588,618 ---- + ######################################## + ## Expiring, syncing + ######################################## + + class SyncTest(SQLObject): + name = StringCol(length=50, alternateID=True) + + class ExpireTest(SQLObjectTest): + + classes = [SyncTest] + + def inserts(self): + SyncTest.new(name='bob') + SyncTest.new(name='tim') + + def testExpire(self): + conn = SyncTest._connection + b = SyncTest.byName('bob') + conn.query("UPDATE sync_test SET name = 'robert' WHERE id = %i" + % b.id) + self.assertEqual(b.name, 'bob') + b.expire() + self.assertEqual(b.name, 'robert') + conn.query("UPDATE sync_test SET name = 'bobby' WHERE id = %i" + % b.id) + b.sync() + self.assertEqual(b.name, 'bobby') ######################################## |