Lukasz
Thanks for the link. In fact what I don't understand ( I am newbie to
Turbogears + SqlAlchemy ) the way model unit testing is set up ( I
don't understand neither your version nor the one generated by the
quickstart tutorials.
in tests/model/__init__.py :
# omitting includes
class ModelTest(object):
"""Base unit test case for the models."""
klass = None
attrs = {}
def setup(self):
try:
new_attrs = {}
new_attrs.update(self.attrs)
new_attrs.update(self.do_get_dependencies())
self.obj = self.klass(**new_attrs)
DBSession.add(self.obj)
DBSession.flush()
return self.obj
except:
DBSession.rollback()
raise
( As far as I understand your solution with the "recall" class is similar )
But how I am supposed to use that ? Lets suppose I want to test my model
class Page (from the wiki20 tut ):
class Page(DeclarativeBase):
__tablename__ = 'pages'
id=Column(Integer, primary_key=True)
pagename=Column(String(30), unique=True)
newcolumn=Column(String(20),unique=False)
data=Column(Text)
def __init__(self, pagename, data):
self.pagename = pagename
self.data = data
Peter