public function UuidUserServicesTest::testUserUpdatePermFail in Universally Unique IDentifier 7
Tests user Update another account fail with no permissions.
File
- uuid_services/
uuid_services.user_services.test, line 155 - Test the UUID User Services integration.
Class
- UuidUserServicesTest
- Test the UUID User Services integration.
Code
public function testUserUpdatePermFail() {
$user = $this
->drupalCreateUser();
$this
->drupalLogin($user);
$other_user = $this
->drupalCreateUser();
$update = array(
'uuid' => $other_user->uuid,
'name' => 'test_edit',
'roles' => array(
'2' => 'authenticated user',
'3' => 'administrator',
),
'status' => 1,
'pass' => $other_user->pass,
);
$response = $this
->servicesPut($this->endpoint->path . '/user/' . $other_user->uuid, $update);
$user_after_update = user_load($other_user->uid, TRUE);
$this
->assertNotEqual($update['name'], $user_after_update->name, 'User name was not updated without the needed permissions');
$this
->assertFalse(in_array('administrator', $user_after_update->roles), 'Administrator role was not added without the needed permissions');
$this
->assertTrue($response['code'] == 403, 'Updating the user failed without the needed permissions');
}