My Account: Updated and started adding to tests

- Updated existing tests now affected by my-account changes.
- Updated some existing tests to more accuractly check the scenario.
- Updated some code styling in SocialController.
- Fixed redirects for social account flows to fit my-account.
- Added test for social account attaching.
- Added test for api token redirect handling.
This commit is contained in:
Dan Brown
2023-10-19 14:18:42 +01:00
parent 12946414b0
commit fabc854390
14 changed files with 302 additions and 227 deletions

View File

@@ -51,7 +51,7 @@ class WebhookCallTest extends TestCase
{
// This test must not fake the queue/bus since this covers an issue
// around handling and serialization of items now deleted from the database.
$this->newWebhook(['active' => true, 'endpoint' => 'https://wh.example.com'], ['all']);
$webhook = $this->newWebhook(['active' => true, 'endpoint' => 'https://wh.example.com'], ['all']);
$this->mockHttpClient([new Response(500)]);
$user = $this->users->newUser();
@@ -61,8 +61,10 @@ class WebhookCallTest extends TestCase
/** @var ApiToken $apiToken */
$editor = $this->users->editor();
$apiToken = ApiToken::factory()->create(['user_id' => $editor]);
$resp = $this->delete($editor->getEditUrl('/api-tokens/' . $apiToken->id));
$resp->assertRedirect($editor->getEditUrl('#api_tokens'));
$this->delete($apiToken->getUrl())->assertRedirect();
$webhook->refresh();
$this->assertEquals('Response status from endpoint was 500', $webhook->last_error);
}
public function test_failed_webhook_call_logs_error()