> I have one example here:
> http://lucasmanual.com/mywiki/TurboGears2#TurboGears2.2BAC8-Addressbook.Testing.2BAC8-UnitTest
>
> not sure how much more info do you need.
> If you have some sample test cases code, please share...
>
>   
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

--

You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=.


Reply via email to