public function ServicesResourceNodetests::testEndpointResourceNodeCreateFail in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceNodeTests.test \ServicesResourceNodetests::testEndpointResourceNodeCreateFail()
testing node_resource Created make ure it fails with no perms
File
- tests/
functional/ ServicesResourceNodeTests.test, line 229 - 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 testEndpointResourceNodeCreateFail() {
// Create and log in our privileged user.
$this->privilegedUser = $this
->drupalCreateUser(array(
'administer services',
));
$this
->drupalLogin($this->privilegedUser);
$node = array(
'title' => 'testing',
'body' => array(
LANGUAGE_NONE => array(
array(
'value' => $this
->randomString(),
),
),
),
'type' => 'page',
'name' => $this->privilegedUser->name,
'language' => LANGUAGE_NONE,
);
$responseArray = $this
->servicesPost($this->endpoint->path . '/node', array(
'node' => $node,
));
$this
->assertTrue($responseArray['code'] == 403, 'User with not sufficient permissions cannot create node', 'NodeResource: Create');
}