GAEUnit testing

Mike 42flicks at gmail.com
Wed Jun 17 06:22:08 EDT 2009


Hello I'm using GAEUnit to develop an app for google appengine and am having
a little trouble.

I'm trying to make a test as follows:

I have a file (say model.py) which contains Model.db model classes and some
methods for accessing them. The methods are not part of the class.

In my test I can call model.save_person(person) which will call
Person(name=person) and Person.put(). I can confirm this is being saved to
the db (app engine db stub) by logging the result of Person.all() under the
call to put.

What I want to do is create a method in model.py called get_people which
will return Person.all().

If I do this the second test returns an empty result set. I think this is
because the second test is not getting the same reference.

In my set up I'd like to set up a Person with details such as address,
phone, preferences and have each test get the data for this person and test
the result of some transformations.

I'd like to do this using the methods in my model.py class, and avoid
importing the database to the test unit and using references to self.

Am I approaching this correctly? How would I implement this?

Thanks for any assistance, I'm new to python and especially unittesting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090617/044259d5/attachment.html>


More information about the Python-list mailing list