The issue is causing the testing bot to report failures that are not noticed when running the web interface version.
The root cause is that when running the web version the $user variable is filled with an authenticated user. When running from run-tests it is an anonymous user.
The upload.test code invokes
node_view($node, TRUE)
To generate a teaser that is then used for assertions. Which then executes the following within the chain.
/**
* Implementation of hook_nodeapi_view().
*/
function upload_nodeapi_view($node, $teaser, $page) {
if (isset($node->files) && user_access('view uploaded files')) {
// Add the attachments list to node body with a heavy
// weight to ensure they're below other elements
if (count($node->files)) {
if (!$teaser && user_access('view uploaded files')) {
$node->content['files'] = array(
'#markup' => theme('upload_attachments', $node->files),
'#weight' => 50,
);
}
}
upload_nodeapi_links($node, $teaser);
}
}
Which checks user_access('view uploaded files') and anonymous does not have that permission. (note calls upload_nodeapi_links() which generates links looked for in assertion which also check permission)
Removing the checks makes the test run with all passes.
Need to find a new way to render the teaser, as all tests that pertain to that should run through web interface. Otherwise we should update $user upon login.
Comments
Comment #1
boombatower commentedThis took an awful long time to debug. I'm going to sleep now...anyone feel free to fix.
Comment #2
catchSeems like we need to give that permission to anonymous users for the purposes of the test see #300993: User roles and permissions API would help.
Comment #3
boombatower commentedI think it is a flaw with either the testing system: that it does not change the $user when drupalLogin is invoked (I believe this has already been suggested), or that the test is using the system wrong and should check the teaser in another fashion.
We could give permission to anonymous users, but I don't think that makes sense as that isn't really the purpose of the test.
Comment #4
damien tournoud commentedThis is very closely related to #283246: Node revisions test fails if admin has a personal timezone offset. At least, the patch in there should solve this issue.
Comment #5
boombatower commentedUpdated other issue (as it does fix this one) and posted corrected patch.
Comment #6
catchPostponed on the $user patch.
Comment #7
boombatower commentedThis was caused by http://drupal.org/node/339929#comment-1156989
Comment #8
boombatower commentedComment #9
dave reidThis has now been fixed in HEAD.