You are here

public function ServicesEndpointTests::testSuccessfulAddEndpoint in Services 7.3

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

Test adding an endpoint succeeds.

File

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

Class

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

Code

public function testSuccessfulAddEndpoint() {
  $edit = $this
    ->populateEndpointFAPI();
  $this->privilegedUser = $this
    ->drupalCreateUser(array(
    'administer services',
    'administer content types',
    'administer site configuration',
  ));
  $this
    ->drupalLogin($this->privilegedUser);
  $this
    ->drupalPost('admin/structure/services/add', $edit, 'Save');
  $this
    ->assertResponse('200', 'expected 200');
  $this
    ->drupalGet('admin/structure/services');
  $this
    ->assertResponse('200', 'expected 200');
  $this
    ->assertText($edit['name'], 'Endpoint path appears');
  $this
    ->assertText('Normal', 'Storage is in database');
}