mirror of https://github.com/MISP/MISP
add: api tests for access logs
parent
51e404bb85
commit
656a3293d0
|
@ -19,7 +19,7 @@ class AccessLogsFixture extends TestFixture
|
|||
$this->records = [
|
||||
[
|
||||
'id' => self::ACCESS_LOG_1_ID,
|
||||
'created' => '#000000',
|
||||
'created' => $faker->dateTime()->getTimestamp(),
|
||||
'user_id' => UsersFixture::USER_ADMIN_ID,
|
||||
'org_id' => OrganisationsFixture::ORGANISATION_A_ID,
|
||||
'request_method' => 0,
|
||||
|
|
|
@ -253,7 +253,6 @@ trait ApiTestTrait
|
|||
$_SERVER['CONTENT_TYPE'] = $this->_request['headers']['Content-Type'];
|
||||
$_SERVER['HTTP_CONTENT_ENCODING'] = $this->_request['headers']['Content-Type'];
|
||||
|
||||
|
||||
$this->_sendRequestOriginal($url, $method, $data);
|
||||
|
||||
// Validate response against OpenAPI spec
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Test\TestCase\Api\AccessLogs;
|
||||
|
||||
use Cake\TestSuite\TestCase;
|
||||
use App\Test\Fixture\AuthKeysFixture;
|
||||
use App\Test\Fixture\AccessLogsFixture;
|
||||
use App\Test\Helper\ApiTestTrait;
|
||||
|
||||
class IndexAccessLogsApiTest extends TestCase
|
||||
{
|
||||
use ApiTestTrait;
|
||||
|
||||
protected const ENDPOINT = '/admin/accessLogs/index';
|
||||
|
||||
protected $fixtures = [
|
||||
'app.Organisations',
|
||||
'app.Users',
|
||||
'app.AuthKeys',
|
||||
'app.AccessLogs',
|
||||
];
|
||||
|
||||
public function testIndexAccessLogs(): void
|
||||
{
|
||||
$this->skipOpenApiValidations();
|
||||
|
||||
$this->setAuthToken(AuthKeysFixture::ADMIN_API_KEY);
|
||||
|
||||
$this->get(self::ENDPOINT);
|
||||
|
||||
$this->assertResponseOk();
|
||||
$this->assertResponseContains(sprintf('"id": %d', AccessLogsFixture::ACCESS_LOG_1_ID));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue