Skip to content

Commit

Permalink
[DRUP-639] Messaging change in the Apigee Edge API.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaesin committed May 3, 2019
1 parent f0c62a6 commit 3541a43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/src/Functional/StatusReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testInvalidCredentials() {
$key->save();

$this->drupalGet($status_report_path);
$this->assertSession()->pageTextContains('Unauthorized');
$this->assertSession()->pageTextContains('Invalid host or public key. Please provide the valid host and key value.');
$this->assertSession()->pageTextContains(self::CANNOT_CONNECT_LONG);

// Create new Apigee Edge OAuth key with private file provider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ protected function validateForm(callable $visitFormAsAdmin): void {
// Test invalid password.
$random_pass = $this->randomString();
$page->fillField('Password', $random_pass);
$this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. The given username ({$this->username}) or password is incorrect. Error message: Unauthorized");
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', 'HTTP/1.1 401 Unauthorized');
$this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. Error message: Invalid host or public key. Please provide the valid host and key value.");
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', 'HTTP/1.1 500 Server Error');
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', '***credentials***');
$web_assert->elementNotContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', $random_pass);
$page->fillField('Password', $this->password);
Expand All @@ -287,7 +287,7 @@ protected function validateForm(callable $visitFormAsAdmin): void {
// Test invalid endpoint.
$invalid_domain = "{$this->randomGenerator->word(16)}.example.com";
$page->fillField('Apigee Edge endpoint', "http://{$invalid_domain}/");
$this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. The given endpoint (http://{$invalid_domain}/) is incorrect or something is wrong with the connection. Error message: cURL error 6: Could not resolve host: {$invalid_domain} (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)");
$this->assertSendRequestMessage('.messages--error', "Failed to connect to Apigee Edge. The given endpoint (http://{$invalid_domain}/) is incorrect or something is wrong with the connection. Error message: cURL error 6: Could not resolve: {$invalid_domain} (Domain name not found) (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)");
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', "\"endpoint\": \"http:\/\/{$invalid_domain}\/\"");
$web_assert->fieldValueEquals('Apigee Edge endpoint', "http://{$invalid_domain}/");
$page->fillField('Apigee Edge endpoint', '');
Expand All @@ -296,7 +296,7 @@ protected function validateForm(callable $visitFormAsAdmin): void {
$this->cssSelect('select[data-drupal-selector="edit-key-input-settings-auth-type"]')[0]->setValue('oauth');
$invalid_domain = "{$this->randomGenerator->word(16)}.example.com";
$page->fillField('Authorization server', "http://{$invalid_domain}/");
$this->assertSendRequestMessage('.messages--error', "Failed to connect to the OAuth authorization server. The given authorization server (http://{$invalid_domain}/) is incorrect or something is wrong with the connection. Error message: cURL error 6: Could not resolve host: {$invalid_domain} (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)");
$this->assertSendRequestMessage('.messages--error', "Failed to connect to the OAuth authorization server. The given authorization server (http://{$invalid_domain}/) is incorrect or something is wrong with the connection. Error message: cURL error 6: Could not resolve: {$invalid_domain} (Domain name not found) (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)");
$web_assert->fieldValueEquals('Authorization server', "http://{$invalid_domain}/");
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', '"auth_type": "oauth"');
$web_assert->elementContains('css', 'textarea[data-drupal-selector="edit-debug-text"]', "\"authorization_server\": \"http:\/\/{$invalid_domain}\/\"");
Expand Down

0 comments on commit 3541a43

Please sign in to comment.