Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed May 30, 2022
1 parent a5521ec commit 9300e11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/Api/Client/ApiKeyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ public function store(StoreApiKeyRequest $request)
*/
public function delete(ClientApiRequest $request, string $identifier)
{
/** @var \Pterodactyl\Models\ApiKey $key */
$key = $request->user()->apiKeys()
->where('key_type', ApiKey::TYPE_ACCOUNT)
->where('identifier', $identifier)
->first();
->firstOrFail();

Activity::event('user:api-key.delete')
->property('identifer', $key->identifer)
->property('identifer', $key->identifier)
->log();

$key->delete();
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/Api/Client/SSHKeyControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function testSSHKeyCanBeDeleted()
$this->assertSoftDeleted($key);
$this->assertNotSoftDeleted($key2);

$this->deleteJson($this->link($key))->assertNoContent();
$this->deleteJson($this->link($key2))->assertNoContent();
$this->deleteJson($this->link($key))->assertNotFound();
$this->deleteJson($this->link($key2))->assertNotFound();

$this->assertNotSoftDeleted($key2);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Integration/IntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ abstract class IntegrationTestCase extends TestCase

protected array $connectionsToTransact = ['mysql'];

protected $defaultHeaders = [
'Accept' => 'application/json',
];

/**
* Return an ISO-8601 formatted timestamp to use in the API response.
*/
Expand Down

0 comments on commit 9300e11

Please sign in to comment.