Hi!
:)
I've been rewriting Trac functional testing infrastructure (mostly
test environments) so as to run the test suite against other component
managers (namely product environments [1]_) .
The fact is that some tests are failing in there (while still running
them against global Trac environment). I've started to focus on tests
for admin panels trying to solve failures like the one shown below:
{{{
#!py
==================
FAIL: Check plugin settings.
------------------------------------
Traceback (most recent call last):
File "/path/to/bloodhound/trac/trac/admin/tests/functional.py", line
117, in runTest
self._tester.go_to_admin()
File "/path/to/bloodhound/trac/trac/tests/functional/tester.py",
line 134, in go_to_admin
tc.follow('\\bAdmin\\b')
File "/usr/lib/pymodules/python2.6/twill/commands.py", line 202, in follow
raise TwillAssertionError("no links match to '%s'" % (what,))
TwillAssertionError: no links match to '\bAdmin\b'
----------------------------------------------------------------------
}}}
Test code is the following
{{{
#!py
class TestPluginSettings(FunctionalTwillTestCaseSetup):
def runTest(self):
"""Check plugin settings."""
self._tester.go_to_admin()
tc.follow('Plugins')
tc.find('Manage Plugins')
tc.find('Install Plugin')
}}}
After digging deep into instance state using PyDev I noticed that
- this is happening due to the fact that admin link is not added in
main nav area
- ... even if AdminModule is listed in navigation contributors list
- ... and admin TRAC_ADMIN is listed in configured permissions
- ... so I guess anonymous request's been sent instead of admin ?
I traced the whole sequence of events and I could not find the exact
place where target request is configured with admin credentials.
Q:
- How is that test case supposed to succeed ?
- What should I do to send request on behalf of admin user ? ... in case
this is the real problem
TIA
.. [1] Bloodhound product environments
(
https://issues.apache.org/bloodhound/wiki/Proposals/BEP-0003#product-envs)
--
Regards,
Olemis.
Apache™ Bloodhound contributor
http://issues.apache.org/bloodhound
Blog ES:
http://simelo-es.blogspot.com/
Blog EN:
http://simelo-en.blogspot.com/
Featured article: