Mercurial > genshi > genshi-test
view examples/turbogears/genshitest/tests/test_model.py @ 445:906b346513b6
Add documentation page on the plugin API.
author | cmlenz |
---|---|
date | Fri, 13 Apr 2007 10:38:12 +0000 |
parents | 24757b771651 |
children |
line wrap: on
line source
# If your project uses a database, you can set up database tests # similar to what you see below. Be sure to set the db_uri to # an appropriate uri for your testing database. sqlite is a good # choice for testing, because you can use an in-memory database # which is very fast. from turbogears import testutil # from genshitest.model import YourDataClass, User # database.set_db_uri("sqlite:///:memory:") # class TestUser(testutil.DBTest): # def get_model(self): # return User # # def test_creation(self): # "Object creation should set the name" # obj = User(user_name = "creosote", # email_address = "spam@python.not", # display_name = "Mr Creosote", # password = "Wafer-thin Mint") # assert obj.display_name == "Mr Creosote"