You are here

public function ServicesResourceNodetests::testEndpointResourceNodeCreateFail in Services 6.3

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

testing node_resource Created make ure it fails with no perms

File

tests/functional/ServicesResourceNodeTests.test, line 192

Class

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

Code

public function testEndpointResourceNodeCreateFail() {

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
  ));
  $this
    ->drupalLogin($this->privilegedUser);
  $node = array(
    'title' => 'testing',
    'body' => 'bodytest',
    'type' => 'story',
    'name' => $this->privilegedUser->name,
  );
  $responseArray = $this
    ->servicesPost($this->endpoint->path . '/node', $node);
  $this
    ->assertTrue($responseArray['code'] == 401, t('User with not sufficient permissions cannot create node'), 'NodeResource: Create');
}