Fix failing tests
This commit is contained in:
parent
a5521ecb79
commit
9300e1116d
3 changed files with 9 additions and 4 deletions
|
@ -60,13 +60,14 @@ class ApiKeyController extends ClientApiController
|
||||||
*/
|
*/
|
||||||
public function delete(ClientApiRequest $request, string $identifier)
|
public function delete(ClientApiRequest $request, string $identifier)
|
||||||
{
|
{
|
||||||
|
/** @var \Pterodactyl\Models\ApiKey $key */
|
||||||
$key = $request->user()->apiKeys()
|
$key = $request->user()->apiKeys()
|
||||||
->where('key_type', ApiKey::TYPE_ACCOUNT)
|
->where('key_type', ApiKey::TYPE_ACCOUNT)
|
||||||
->where('identifier', $identifier)
|
->where('identifier', $identifier)
|
||||||
->first();
|
->firstOrFail();
|
||||||
|
|
||||||
Activity::event('user:api-key.delete')
|
Activity::event('user:api-key.delete')
|
||||||
->property('identifer', $key->identifer)
|
->property('identifer', $key->identifier)
|
||||||
->log();
|
->log();
|
||||||
|
|
||||||
$key->delete();
|
$key->delete();
|
||||||
|
|
|
@ -46,8 +46,8 @@ class SSHKeyControllerTest extends ClientApiIntegrationTestCase
|
||||||
$this->assertSoftDeleted($key);
|
$this->assertSoftDeleted($key);
|
||||||
$this->assertNotSoftDeleted($key2);
|
$this->assertNotSoftDeleted($key2);
|
||||||
|
|
||||||
$this->deleteJson($this->link($key))->assertNoContent();
|
$this->deleteJson($this->link($key))->assertNotFound();
|
||||||
$this->deleteJson($this->link($key2))->assertNoContent();
|
$this->deleteJson($this->link($key2))->assertNotFound();
|
||||||
|
|
||||||
$this->assertNotSoftDeleted($key2);
|
$this->assertNotSoftDeleted($key2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,10 @@ abstract class IntegrationTestCase extends TestCase
|
||||||
|
|
||||||
protected array $connectionsToTransact = ['mysql'];
|
protected array $connectionsToTransact = ['mysql'];
|
||||||
|
|
||||||
|
protected $defaultHeaders = [
|
||||||
|
'Accept' => 'application/json',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an ISO-8601 formatted timestamp to use in the API response.
|
* Return an ISO-8601 formatted timestamp to use in the API response.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue