Good afternoon,
I'm currently trying to learn TurboGears, as well as playing around with test-driven development. I'm trying to write a budgeting program, so I'd like to turn on security using identity. This works well, except that it breaks my controller unit tests. My test class is:
----
class TestBudgetMethods(testutil.DBTest):
def test_getBudgetOwnedByBill(self):
"Set up Bill's budget in the database and return it"
# Arrange
budget = Budget(name = "Test1", owner = "Bill")
# Act
result = testutil.call(cherrypy.root.getBudget,
name = "Test1",
owner="Bill")
# Assert
assert result['owner'] == "Bill"
----
and my controller method (under the CherryPy root controller) is:
----
@identity.require(identity.not_anonymous())
@expose()
def getBudget(self, name, owner):
budget = Budget.select(AND(Budget.q.name == name,
Budget.q.owner == owner))
try:
name = budget[0].name
owner = budget[0].owner
envelopes = list(budget[0].envelopes)
return dict(name = name, owner = owner, envelopes = envelopes)
except IndexError:
return "None"
----
When I test this without the @identity.require, it works fine. When I test it with the @identity.require, I get a "IdentityConfigurationException: Missing URL for identity failure". Obviously, I need to login in the test, but I don't know how.
Any clues?
Thanks,
- Bill
--
Bill Woodward [EMAIL PROTECTED]
http://www.saifa.net
"I have more trouble with D. L. Moody than with any other man I ever met." -- D. L. Moody
s/D. L. Moody/Bill Woodward/g
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [TurboGears] Testing a CherryPy method that uses identity Bill Woodward

