You are here

function ServicesResourceSystemTests::testSystemConnect in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesResourceSystemTests.test \ServicesResourceSystemTests::testSystemConnect()

Test connect method.

File

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

Class

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

Code

function testSystemConnect() {
  $path = $this->endpoint->path;

  // Call as authenticated user.
  $response = $this
    ->servicesPost($path . '/system/connect');
  $response_user = $response['body']->user;
  $this
    ->assertEqual($response_user->uid, $this->privileged_user->uid, 'User account received for authenticated user.', 'SystemResource: Connect');
  $this
    ->drupalLogout();

  // Call as anonymous user.
  $response = $this
    ->servicesPost($path . '/system/connect');
  $response_user = $response['body']->user;
  $this
    ->assertEqual($response_user->uid, 0, 'User account received for anonymous user.', 'SystemResource: Connect');
}