Skip to content

Commit 9300e11

Browse files
committed
Fix failing tests
1 parent a5521ec commit 9300e11

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/Http/Controllers/Api/Client/ApiKeyController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ public function store(StoreApiKeyRequest $request)
6060
*/
6161
public function delete(ClientApiRequest $request, string $identifier)
6262
{
63+
/** @var \Pterodactyl\Models\ApiKey $key */
6364
$key = $request->user()->apiKeys()
6465
->where('key_type', ApiKey::TYPE_ACCOUNT)
6566
->where('identifier', $identifier)
66-
->first();
67+
->firstOrFail();
6768

6869
Activity::event('user:api-key.delete')
69-
->property('identifer', $key->identifer)
70+
->property('identifer', $key->identifier)
7071
->log();
7172

7273
$key->delete();

tests/Integration/Api/Client/SSHKeyControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function testSSHKeyCanBeDeleted()
4646
$this->assertSoftDeleted($key);
4747
$this->assertNotSoftDeleted($key2);
4848

49-
$this->deleteJson($this->link($key))->assertNoContent();
50-
$this->deleteJson($this->link($key2))->assertNoContent();
49+
$this->deleteJson($this->link($key))->assertNotFound();
50+
$this->deleteJson($this->link($key2))->assertNotFound();
5151

5252
$this->assertNotSoftDeleted($key2);
5353
}

tests/Integration/IntegrationTestCase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ abstract class IntegrationTestCase extends TestCase
1313

1414
protected array $connectionsToTransact = ['mysql'];
1515

16+
protected $defaultHeaders = [
17+
'Accept' => 'application/json',
18+
];
19+
1620
/**
1721
* Return an ISO-8601 formatted timestamp to use in the API response.
1822
*/

0 commit comments

Comments
 (0)