Fix tests
This commit is contained in:
parent
f2d8a5091d
commit
f74a6f36ed
2 changed files with 9 additions and 9 deletions
|
@ -163,7 +163,7 @@ class MicropubController extends Controller
|
|||
public function get(Request $request)
|
||||
{
|
||||
$tokenData = $this->tokenService->validateToken($request->bearerToken());
|
||||
if ($valid === null) {
|
||||
if ($tokenData === null) {
|
||||
return response()->json([
|
||||
'response' => 'error',
|
||||
'error' => 'invalid_token',
|
||||
|
@ -208,9 +208,9 @@ class MicropubController extends Controller
|
|||
return response()->json([
|
||||
'response' => 'token',
|
||||
'token' => [
|
||||
'me' => $valid->getClaim('me'),
|
||||
'scope' => $valid->getClaim('scope'),
|
||||
'client_id' => $valid->getClaim('client_id'),
|
||||
'me' => $tokenData->getClaim('me'),
|
||||
'scope' => $tokenData->getClaim('scope'),
|
||||
'client_id' => $tokenData->getClaim('client_id'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ class MicropubControllerTest extends TestCase
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_micropub_request_without_token_returns_400_response()
|
||||
public function test_micropub_request_without_token_returns_401_response()
|
||||
{
|
||||
$response = $this->get('/api/post');
|
||||
$response->assertStatus(400);
|
||||
$response->assertJsonFragment(['error_description' => 'No token provided with request']);
|
||||
$response->assertStatus(401);
|
||||
$response->assertJsonFragment(['error_description' => 'No access token was provided in the request']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,9 +202,9 @@ class MicropubControllerTest extends TestCase
|
|||
$response
|
||||
->assertJson([
|
||||
'response' => 'error',
|
||||
'error' => 'no_token'
|
||||
'error' => 'unauthorized'
|
||||
])
|
||||
->assertStatus(400);
|
||||
->assertStatus(401);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue