public function ApigeeEdgeManagementCliServiceTest::testIsValidEdgeCredentialsValid in Apigee Edge 8
Should return true if creds are valid.
File
- tests/
src/ Unit/ Command/ Util/ ApigeeEdgeManagementCliServiceTest.php, line 311
Class
- ApigeeEdgeManagementCliServiceTest
- Test ApigeeEdgeManagementCliService.
Namespace
Drupal\Tests\apigee_edge\Unit\Command\UtilCode
public function testIsValidEdgeCredentialsValid() {
// Org should exist.
$response_org = $this
->prophesize(Response::class);
$response_org
->getBody()
->shouldBeCalledTimes(1)
->willReturn('{ "name": "' . $this->org . '" }');
$this->httpClient
->get(Argument::exact($this->baseUrl . '/o/' . $this->org), Argument::type('array'))
->shouldBeCalledTimes(1)
->willReturn($response_org
->reveal());
// Errors should not be called.
$io = $this
->prophesize(StyleInterface::class);
$io
->error(Argument::type('string'))
->shouldNotBeCalled();
$io
->section(Argument::type('string'))
->shouldNotBeCalled();
$io
->text(Argument::type('string'))
->shouldNotBeCalled();
$io
->success(Argument::type('string'))
->shouldBeCalled();
$apigee_edge_management_cli_service = new ApigeeEdgeManagementCliService($this->httpClient
->reveal());
$is_valid_creds = $apigee_edge_management_cli_service
->isValidEdgeCredentials($io
->reveal(), [
$this,
'mockDt',
], $this->org, $this->email, $this->password, $this->baseUrl);
// Assertions.
$this
->assertEquals(TRUE, $is_valid_creds, 'Credentials are not valid, should return false.');
}