mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Removed remaining deprecated elements
This commit is contained in:
@@ -59,51 +59,4 @@ class AuthenticationTest extends ApiTestCase
|
||||
yield 'key which is expired' => ['expired_api_key'];
|
||||
yield 'key which is disabled' => ['disabled_api_key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @dataProvider provideInvalidAuthorizations
|
||||
*/
|
||||
public function authorizationErrorIsReturnedIfInvalidDataIsProvided(
|
||||
string $authValue,
|
||||
string $expectedDetail,
|
||||
string $expectedType,
|
||||
string $expectedTitle
|
||||
): void {
|
||||
$resp = $this->callApi(self::METHOD_GET, '/short-urls', [
|
||||
'headers' => [
|
||||
Plugin\AuthorizationHeaderPlugin::HEADER_NAME => $authValue,
|
||||
],
|
||||
]);
|
||||
$payload = $this->getJsonResponsePayload($resp);
|
||||
|
||||
$this->assertEquals(self::STATUS_UNAUTHORIZED, $resp->getStatusCode());
|
||||
$this->assertEquals(self::STATUS_UNAUTHORIZED, $payload['status']);
|
||||
$this->assertEquals($expectedType, $payload['type']);
|
||||
$this->assertEquals($expectedDetail, $payload['detail']);
|
||||
$this->assertEquals($expectedTitle, $payload['title']);
|
||||
}
|
||||
|
||||
public function provideInvalidAuthorizations(): iterable
|
||||
{
|
||||
yield 'no type' => [
|
||||
'invalid',
|
||||
'You need to provide the Bearer type in the Authorization header.',
|
||||
'INVALID_AUTHORIZATION',
|
||||
'Invalid authorization',
|
||||
];
|
||||
yield 'invalid type' => [
|
||||
'Basic invalid',
|
||||
'Provided authorization type Basic is not supported. Use Bearer instead.',
|
||||
'INVALID_AUTHORIZATION',
|
||||
'Invalid authorization',
|
||||
];
|
||||
yield 'invalid JWT' => [
|
||||
'Bearer invalid',
|
||||
'Missing or invalid auth token provided. Perform a new authentication request and send provided '
|
||||
. 'token on every new request on the Authorization header',
|
||||
'INVALID_AUTH_TOKEN',
|
||||
'Invalid auth token',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user