Hi kerinin,
The test_model.py file made by quickstart should work fine. Below is an
'all in' example which might clear things up a bit. It should run fine
when you cut and paste it into a test_*.py file.
from sqlobject import *
from turbogears.database import PackageHub
hub = PackageHub("organizer")
__connection__ = hub
class Event(SQLObject):
name = StringCol(length=200, alternateID=True, notNone=True)
# XXX: Can't use these without the refferenced classes
#dependancies = MultipleJoin( 'Dependancy')
#resources = RelatedJoin( 'Resource' )
#to_do = RelatedJoin( 'OrganizerTaskItem' )
schedule_preference = EnumCol(enumValues=['earlier','later'],
default='earlier')
explicit_date = DateTimeCol(default=None)
completion_date = DateTimeCol(default=None)
# Since I have cramped everything into one single file i need to create
# a 'fake' model module.
# Normaly you would just import the model module e.g,
# from organizer import model
import new
model = new.module('model')
model.Event = Event
from turbogears import testutil, database
class TestEvent(testutil.DBTest):
model = model
def test_creation(self):
e=Event(name="Event Name")
assert e.name == "Event Name"
assert Event.get(1) == e
assert e.completion_date == None
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---