You are here

public function ApigeeEdgeManagementCliServiceTest::testIsValidEdgeCredentialsEdgeApi in Apigee Edge 8

Test actual call to Edge API that IsValidEdgeCredentials() uses.

File

tests/src/Kernel/Util/ApigeeEdgeManagementCliServiceTest.php, line 168

Class

ApigeeEdgeManagementCliServiceTest
ApigeeEdgeManagementCliService Edge tests.

Namespace

Drupal\Tests\apigee_edge\Kernel\Util

Code

public function testIsValidEdgeCredentialsEdgeApi() {
  $this->stack
    ->queueMockResponse([
    'get_organization' => [
      'org_name' => $this->organization,
    ],
  ]);
  $url = $this->endpoint . '/o/' . $this->organization;
  $response = $this->httpClient
    ->get($url);
  $body = json_decode($response
    ->getBody());
  $this
    ->assertTrue(isset($body->name), 'Edge org entity should contain "name" attribute.');
  $this
    ->assertEquals($this->organization, $body->name, 'Edge org name attribute should match org being called in url.');
}