[SQL-CVS] SQLObject/tests test.py,1.6,1.7
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <ian...@us...> - 2003-04-17 07:15:22
|
Update of /cvsroot/sqlobject/SQLObject/tests In directory sc8-pr-cvs1:/tmp/cvs-serv29696/tests Modified Files: test.py Log Message: Added basic functionality test Fixed properties bug (where only overriding one of get/set wouldn't cause the other one to be used) Index: test.py =================================================================== RCS file: /cvsroot/sqlobject/SQLObject/tests/test.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test.py 7 Apr 2003 19:48:44 -0000 1.6 --- test.py 17 Apr 2003 07:15:17 -0000 1.7 *************** *** 4,7 **** --- 4,35 ---- ######################################## + ## Basic operation + ######################################## + + class TestSO1(SQLObject): + + _columns = [ + StringCol('name', length=10), + StringCol('passwd', length=10), + ] + + def _set_passwd(self, passwd): + self._SO_set_passwd(passwd.encode('rot13')) + + class TestCase1(SQLObjectTest): + + classes = [TestSO1] + + def inserts(self): + for name, passwd in [('bob', 'god'), ('sally', 'sordid'), + ('dave', 'dremel'), ('fred', 'forgo')]: + TestSO1.new(name=name, passwd=passwd) + + def testGet(self): + bob = TestSO1.selectBy(name='bob')[0] + self.assertEqual(bob.name, 'bob') + self.assertEqual(bob.passwd, 'god'.encode('rot13')) + + ######################################## ## Slicing tests ######################################## |