mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-04 10:14:13 +08:00
Add legacy api re-direction
- Listen to legacy api calls on the LegacyRedirectListener - Add LegacyApiRedirectHandler to re-direct to legacy endpoint -- Using 307 re-direction response to support post re-direction -- Using api_paths.yaml with the configuration with paths to check - Setup API tests using codeception -- Add helper methods to login in v4 and v8 API - Add Api test to create account using v4 api - Add Api test to create account using v8 api - Add unit test for LegacyApiRedirectHandler
This commit is contained in:
parent
2a489cbc7e
commit
6c3e266b5d
18 changed files with 797 additions and 112 deletions
57
tests/api/v8/V8ApiAccountsCest.php
Normal file
57
tests/api/v8/V8ApiAccountsCest.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php namespace App\Tests;
|
||||
|
||||
use Codeception\Util\HttpCode;
|
||||
use Exception;
|
||||
|
||||
class V8ApiAccountsCest
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $token;
|
||||
|
||||
/**
|
||||
* @param ApiTester $I
|
||||
* @throws Exception
|
||||
*/
|
||||
public function _before(ApiTester $I): void
|
||||
{
|
||||
$this->token = $I->v8Login($I->getConfig('client_id'), $I->getConfig('client_secret'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test account record creation
|
||||
* @param ApiTester $I
|
||||
*/
|
||||
public function create(ApiTester $I): void
|
||||
{
|
||||
|
||||
$I->amBearerAuthenticated($this->token);
|
||||
$I->sendPOST($I->getV8Path('/V8/module'), [
|
||||
'data' => [
|
||||
'type' => 'Accounts',
|
||||
'attributes' => [
|
||||
'name' => 'V8 Api test Account'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$I->seeResponseCodeIs(HttpCode::CREATED); // 200
|
||||
$I->seeResponseIsJson();
|
||||
|
||||
$uuidTypeCheck = $I->getUuidJsonType();
|
||||
|
||||
$I->seeResponseContainsJson([
|
||||
'type' => 'Account',
|
||||
]);
|
||||
|
||||
$I->seeResponseMatchesJsonType([
|
||||
'data' => [
|
||||
'id' => $uuidTypeCheck,
|
||||
]
|
||||
]);
|
||||
|
||||
$I->seeResponseContainsJson([
|
||||
'name' => 'V8 Api test Account'
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue