Update of /cvsroot/webware/Webware/MiddleKit/Tests/MKObjRef.mkmodel
In directory usw-pr-cvs1:/tmp/cvs-serv19175/Tests/MKObjRef.mkmodel
Modified Files:
Classes.csv
Added Files:
TestEmpty3.py
Log Message:
- fix obscure bug involving _inherited_ obj refs that have to be UPDATEd
post-INSERT.
--- NEW FILE: TestEmpty3.py ---
def test(store):
"""
Bug discovered by Chuck Esterbrook on 2002-10-29.
"""
from Bar import Bar
from Qux import Qux
# import sys; store._sqlEcho = sys.stdout
# Since we're the second empty test, double check that the db is really empty
assert len(store.fetchObjectsOfClass(Bar))==0
assert len(store.fetchObjectsOfClass(Qux))==0
qux = Qux()
store.addObject(qux)
bar = Bar()
qux.setBar(bar)
store.addObject(bar)
store.saveChanges()
quxes = store.fetchObjectsOfClass(Qux)
assert len(quxes)==1
qux2 = quxes[0]
assert qux2 is qux
assert qux.bar() is not None # the sign of the bug in question
assert qux.bar() is bar # what we should expect
store.clear()
qux = store.fetchObjectsOfClass(Qux)[0]
assert qux.bar() is not None
Index: Classes.csv
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Tests/MKObjRef.mkmodel/Classes.csv,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Classes.csv 20 Aug 2001 13:00:35 -0000 1.2
--- Classes.csv 29 Oct 2002 10:29:15 -0000 1.3
***************
*** 2,9 ****
--- 2,13 ----
Foo,,,
,x,int,0
+ ,bar,Bar,0
+
Bar,,,
,foo,Foo,0
+
BarReq,,,
,foo,Foo,1
+
Qux(Foo),,,
,y,int,0
|