1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

Tests: Use new authenticatedAs option where useful

There are two more API integration tests that explicitly add the
"Authorization" header right now:

- `Flarum\Tests\integration\api\authentication\WithApiKeyTest`
- `Flarum\Tests\integration\api\csrf_protection\RequireCsrfTokenTest`

These two specifically test authentication, so in those cases the
explicitness seems desirable.
This commit is contained in:
Franz Liedke
2020-03-20 18:28:28 +01:00
parent 25f772c1ea
commit f31fbc5bcf
3 changed files with 8 additions and 14 deletions

View File

@@ -24,9 +24,6 @@ class ListTest extends TestCase
'users' => [
$this->normalUser(),
],
'access_tokens' => [
['token' => 'normaltoken', 'user_id' => 2],
],
]);
}
@@ -48,8 +45,9 @@ class ListTest extends TestCase
public function shows_index_for_user()
{
$response = $this->send(
$this->request('GET', '/api/notifications')
->withHeader('Authorization', 'Token normaltoken')
$this->request('GET', '/api/notifications', [
'authenticatedAs' => 2,
])
);
$this->assertEquals(200, $response->getStatusCode());