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

boombatower’s picture

Assigned: boombatower » Unassigned

This took an awful long time to debug. I'm going to sleep now...anyone feel free to fix.

catch’s picture

Seems 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.

boombatower’s picture

I 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.

Damien Tournoud’s picture

This 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.

boombatower’s picture

Updated other issue (as it does fix this one) and posted corrected patch.

catch’s picture

Status: Active » Postponed

Postponed on the $user patch.

boombatower’s picture

boombatower’s picture

Status: Postponed » Fixed
Dave Reid’s picture

This has now been fixed in HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.