I am having trouble getting nosetests to function properly with
a sqlalchemy database and tg-regstration.  I am using this as a test
case
for building a larger test suite, but can't seem to get past step 1.

For example the tg-registration code uses the following

class TestRegistrationModel(unittest.TestCase, SharedMethods):
    def setUp(self):
        database.create_session()
        self.create_identity_tables()
        register_model.create_registration_tables()
        cherrypy.server.stop()
        cherrypy.root = None
        cherrypy.tree.mount_points = {}
        cherrypy.tree.mount(RegTestController(), '/')
        config.update({'global':{'registration.verified_user.groups':
[],
                                'registration.unverified_user.groups':
[] }
                        })

    def tearDown(self):
        database.rollback_all()
        self.drop_identity_tables()
        self.drop_registration_tables()
        testutil.sqlalchemy_cleanup()
        startup.stopTurboGears()

However, this fails almost immediatley due to a missing mappers (???)

======================================================================
ERROR: A new pending user is created.
----------------------------------------------------------------------

Traceback (most recent call last):
  File "/home/kgk/work/bisquik/development/TG/bisquik/tests/
test_registration.py", line 81, in test_new_registration
    self.create_pending_user_by_request()
  File "/home/kgk/work/bisquik/development/TG/bisquik/tests/
test_registration.py", line 34, in create_pending_user_by_request
    testutil.createRequest(req_str)
  File "/var/lib/python-support/python2.4/turbogears/testutil.py",
line 88, in create_request
    startup.startTurboGears()
  File "/var/lib/python-support/python2.4/turbogears/startup.py", line
234, in startTurboGears
    ext.start_extension()
  File "/var/lib/python-support/python2.4/turbogears/visit/api.py",
line 113, in start_extension
    create_extension_model()
  File "/var/lib/python-support/python2.4/turbogears/visit/api.py",
line 132, in create_extension_model
    _manager.create_model()
  File "/var/lib/python-support/python2.4/turbogears/visit/
savisit.py", line 39, in create_model
    class_mapper(visit_class).local_table.create(checkfirst=True)
  File "/var/lib/python-support/python2.4/sqlalchemy/orm/mapper.py",
line 1574, in class_mapper
    raise exceptions.InvalidRequestError("Class '%s' entity name '%s'
has no mapper associated with it" % (class_.__name__, entity_name))
InvalidRequestError: Class 'Visit' entity name 'None' has no mapper
associated with it

======================================================================
ERROR: A unvalidated user is made a real user in the unvalidated
group(s).



Does somebody have some boiler plate test scripts. that for each test

1.  create the database and setup the model
2.  Allow you to create requests
3.  Repeat 1 &2  in the same test


--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to