You are here

function ServicesResourceSystemTests::testSystemConnect in Services 6.3

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

Test connect method.

File

tests/functional/ServicesResourceSystemTests.test, line 53

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, t('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, t('User account received for anonymous user.'), 'SystemResource: Connect');
}