Hi, I'm having some trouble writing unit tests for a secured object.
The controller code is as follows:
foo= Foo()
foo = identity.SecureObject(foo,
identity.from_any_host(cherrypy.config.get("identity.allowed_hosts",["127.0.0.1"])))
Next i'm trying to test this controller as described in the docs:
def test_index():
cherrypy.root = Root()
d = testutil.call(cherrypy.root.index)
assert d['title'] == 'A greate title'
Yet this raises IdentityFailure.
Digging into identity and testutil it appears that the allowed_hosts
predicate uses cherrypy.request.remoteHost which isn't set in the
DummyRequest used by testutils.call(). I have attached a patch which
sets this attribute to '127.0.0.1'. Yet i'm not sure if this is the
best way to go about.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---