You are here

public function ServicesResourceNodetests::testNewEndpointResourceNodeGet in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesResourceNodeTests.test \ServicesResourceNodetests::testNewEndpointResourceNodeGet()

testing node_resource Get

File

tests/functional/ServicesResourceNodeTests.test, line 113
Call the endpoint tests when no authentication is being used.

Class

ServicesResourceNodetests
Run test cases for the endpoint with no authentication turned on.

Code

public function testNewEndpointResourceNodeGet() {

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
  ));
  $this
    ->drupalLogin($this->privilegedUser);
  $node = $this
    ->drupalCreateNode();
  $responseArray = $this
    ->servicesGet($this->endpoint->path . '/node/' . $node->nid);
  $this
    ->assertTrue($node->title == $responseArray['body']->title, 'Successfully received Node info', 'NodeResource: Retrieve');

  //Verify node not found.
  unset($node);
  $responseArray = $this
    ->servicesGet($this->endpoint->path . '/node/99');
  $this
    ->assertTrue($responseArray['code'] == '404', 'Successfully was rejected to non existent node', 'NodeResource: Retrieve');
}