Index: node_revisions.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/node_revisions.test,v retrieving revision 1.3 diff -u -r1.3 node_revisions.test --- node_revisions.test 13 Jan 2008 16:16:13 -0000 1.3 +++ node_revisions.test 25 Jan 2008 03:24:32 -0000 @@ -18,7 +18,8 @@ * If $log is TRUE, then a log message will be recorded. */ function prepareRevisions($log = FALSE) { - + $test_user = $this->drupalCreateUserRolePerm(array('view revisions', 'administer nodes', 'create page', 'edit any page content')); + $this->drupalLoginUser($test_user); $returnarray = array(); $numtimes = 3; // First, middle, last. for ($i = 0; $i < $numtimes; $i++) { @@ -40,6 +41,7 @@ sleep(1); } $returnarray['node'] = $node; + $this->drupalLogoutUser(); return $returnarray; } @@ -49,7 +51,7 @@ function testNodeRevisions() { extract( $this->prepareRevisions() ); - $test_user = $this->drupalCreateUserRolePerm(array('view revisions')); + $test_user = $this->drupalCreateUserRolePerm(array('view revisions', 'access content')); $this->drupalLoginUser($test_user); $this->drupalGet("node/$node->nid/revisions/$vid/view"); $this->assertText($text, 'Check to make sure correct revision text appears on "view revisions" page.'); Index: page_view.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/page_view.test,v retrieving revision 1.13 diff -u -r1.13 page_view.test --- page_view.test 13 Jan 2008 16:16:13 -0000 1.13 +++ page_view.test 25 Jan 2008 02:45:35 -0000 @@ -20,6 +20,9 @@ function testPageView() { /* Prepare a node to view */ global $user; + $test_user = $this->drupalCreateUserRolePerm(array('create page content')); + $this->drupalLoginUser($test_user); + $node = $this->drupalCreateNode(); $this->assertNotNull(node_load($node->nid), 'Node created'); @@ -27,10 +30,8 @@ $html = $this->drupalGet("node/$node->nid/edit"); $this->assertResponse(403); - /* Prepare a user to request the node view */ - $test_user = $this->drupalCreateUserRolePerm(array('access content')); - $this->drupalLoginUser($test_user); - + //log out user and try to edit + $this->drupalLogoutUser(); $html = $this->drupalGet("node/$node->nid/edit"); $this->assertResponse(403); Index: story_edit.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/story_edit.test,v retrieving revision 1.1 diff -u -r1.1 story_edit.test --- story_edit.test 3 Dec 2007 20:32:06 -0000 1.1 +++ story_edit.test 25 Jan 2008 03:02:44 -0000 @@ -1,58 +1,52 @@ - 'Story edit test', - 'desc' => t('We want a working edit for storys, uh?'), - 'group' => 'Node Tests'); - } - function testStoryEdit() { - - /* Prepare settings */ - $this->drupalVariableSet('node_options_story', array('status', 'promote')); - /* Prepare a user to do the stuff */ - $web_user = $this->drupalCreateUserRolePerm(array('edit own story content', 'create story content')); - $this->drupalLoginUser($web_user); - $edit = array( - 'title' => '!SimpleTest! test title' . $this->randomName(20), - 'body' => '!SimpleTest! test body' . $this->randomName(200), - ); - - //Create the page to edit - $this->drupalPostRequest('node/add/story', $edit, 'Save'); - - $node = node_load(array('title' => $edit['title'])); - $this->assertNotNull($node, 'Node found in database'); - - $this->clickLink('Edit'); - - $editurl = url("node/$node->nid/edit", array('absolute' => true)); - $acturl = $this->_browser->getURL(); - - $this->assertEqual($editurl, $acturl); - - $this->assertWantedText(t('Edit'), 'Edit text is here'); - $this->assertWantedText(t($edit['title']), 'Hello, the random title'); - $this->assertWantedText(t($edit['body']), 'test is over, the body\'s still there'); - - $edit = array( - 'title' => '!SimpleTest! test title' . $this->randomName(20), - 'body' => '!SimpleTest! test body' . $this->randomName(200), - ); - - - //edit the content of the page - $this->drupalPostRequest("node/$node->nid/edit", $edit, 'Save'); - - $this->assertWantedText(t($edit['title']), 'Hello, the random title'); - $this->assertWantedText(t($edit['body']), 'test is over, the body\'s still there'); - } - -} + 'Story edit test', + 'desc' => t('We want a working edit for storys, uh?'), + 'group' => 'Node Tests'); + } + function testStoryEdit() { + + /* Prepare settings */ + $this->drupalVariableSet('node_options_story', array('status', 'promote')); + /* Prepare a user to do the stuff */ + $web_user = $this->drupalCreateUserRolePerm(array('edit own story content', 'create story content', 'administer nodes')); + $this->drupalLoginUser($web_user); + $edit = array( + 'title' => '!SimpleTest! test title' . $this->randomName(20), + 'body' => '!SimpleTest! test body' . $this->randomName(200), + 'promote' => 1, + 'status' => 1 + ); + + //Create the page to edit + $node = $this->drupalCreateNode($edit, 'story'); + + $this->drupalGet("node/$node->nid"); + $this->clickLink('Edit'); + $this->assertWantedText(t('Edit'), 'Edit text is here'); + $this->assertWantedText(t($edit['title']), 'Hello, the random title'); + $this->assertWantedText(t($edit['body']), 'test is over, the body\'s still there'); + + $edit = array( + 'title' => '!SimpleTest! test title' . $this->randomName(20), + 'body' => '!SimpleTest! test body' . $this->randomName(200), + ); + + + //edit the content of the page + $this->drupalPostRequest("node/$node->nid/edit", $edit, 'Save'); + + $this->assertWantedText(t($edit['title']), 'Hello, the random title'); + $this->assertWantedText(t($edit['body']), 'test is over, the body\'s still there'); + } + +}