|
From: <de...@us...> - 2004-01-16 01:22:09
|
Update of /cvsroot/pymerase/pymerase/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv7382
Modified Files:
TestSchool.py
Log Message:
Add tests for new-style attribute access
Index: TestSchool.py
===================================================================
RCS file: /cvsroot/pymerase/pymerase/tests/TestSchool.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** TestSchool.py 18 Dec 2003 00:11:28 -0000 1.11
--- TestSchool.py 16 Jan 2004 01:22:06 -0000 1.12
***************
*** 435,440 ****
finally:
s.close()
-
def testOneToOneUpdate(self):
"""Make sure that set replaces not appends with a one to one links
--- 435,467 ----
finally:
s.close()
+ def testNewAttributeAccess(self):
+ """test new-style python attribute access
+ implementation by Luis Rodrigo Gallardo Cruz
+ """
+ import school
+ school.moduleReload()
+ s = schoo.DBSession(host, datbase)
+
+ try:
+ guiseppe = s.Staff()
+ guiseppe.Uid = "0014"
+ guiseppe.GivenName = "Guiseppe"
+ guiseppe.FamilyName = "Gallard"
+ guiseppe.JobDescription = "accountant"
+ guiseppe.commit()
+
+ givenNameQuery = "%s = 'Guiseppe'" % (givenNameFieldName)
+ guiseppe_list = s.getObjectsWhere(s.Staff, givenNameQuery)
+ self.failUnless(len(guiseppe_list) == 1)
+ guiseppe_saved = guiseppe_list[0]
+
+ self.failUnless(guiseppe.Uid == guiseppe_saved.getGivenName())
+ self.failUnless(guiseppe.GivenName == guiseppe_saved.getGivenName())
+ self.failUnless(guiseppe.FamilyName == guiseppe_saved.getFamilyName())
+ self.failUnless(guiseppe.JobDescription == guiseppe_saved.getJobDescription())
+ finally:
+ s.close()
+
def testOneToOneUpdate(self):
"""Make sure that set replaces not appends with a one to one links
***************
*** 602,605 ****
--- 629,633 ----
suite.addTest(CreateSchoolTestCases("testReadManyToManyLink"))
suite.addTest(CreateSchoolTestCases("testOneToOneInsert"))
+ suite.addTest(CreateSchoolTestCases("testNewAttributeAccess"))
suite.addTest(CreateSchoolTestCases("testOneToOneUpdate"))
suite.addTest(CreateSchoolTestCases("testManyToOneInsert"))
|