mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 14:54:34 -04:00
Api routes upate
This commit is contained in:
parent
e163135f1f
commit
4e84d83db1
@ -112,7 +112,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
|||||||
|
|
||||||
Route::post('templates', 'TemplateController@show')->name('templates.show');
|
Route::post('templates', 'TemplateController@show')->name('templates.show');
|
||||||
|
|
||||||
Route::post('preview', 'PreviewController@show');
|
Route::post('preview', 'PreviewController@show')->name('preview.show');
|
||||||
|
|
||||||
Route::post('self-update', 'SelfUpdateController@update')->middleware('password_protected');
|
Route::post('self-update', 'SelfUpdateController@update')->middleware('password_protected');
|
||||||
|
|
||||||
|
@ -1,89 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Feature;
|
|
||||||
|
|
||||||
use App\Designs\Designer;
|
|
||||||
use App\Jobs\Account\CreateAccount;
|
|
||||||
use App\Models\Account;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\Design;
|
|
||||||
use App\Models\User;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Utils\Traits\UserSessionAttributes;
|
|
||||||
use Faker\Factory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Illuminate\Foundation\Testing\WithFaker;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Session;
|
|
||||||
use Tests\MockAccountData;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @covers App\Http\Controllers\PreviewController
|
|
||||||
*/
|
|
||||||
|
|
||||||
class PreviewTest extends TestCase
|
|
||||||
{
|
|
||||||
use MakesHash;
|
|
||||||
use DatabaseTransactions;
|
|
||||||
use MockAccountData;
|
|
||||||
|
|
||||||
public function setUp() :void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->makeTestData();
|
|
||||||
|
|
||||||
Session::start();
|
|
||||||
|
|
||||||
$this->faker = \Faker\Factory::create();
|
|
||||||
|
|
||||||
Model::reguard();
|
|
||||||
|
|
||||||
|
|
||||||
if (config('ninja.testvars.travis') !== false) {
|
|
||||||
$this->markTestSkipped('Skip test for CI Testing');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function testPreviewDesign()
|
|
||||||
{
|
|
||||||
$design = Design::find(3);
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'entity' => 'invoice',
|
|
||||||
'entity_id' => $this->invoice->hashed_id,
|
|
||||||
'design' => $design,
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
|
||||||
'X-API-TOKEN' => $this->token
|
|
||||||
])->post('/api/v1/preview', $data)->assertStatus(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function testBlankEntityPreviewDesign()
|
|
||||||
{
|
|
||||||
$design = Design::find(3);
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'design' => $design,
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
|
||||||
'X-API-TOKEN' => $this->token
|
|
||||||
])->post('/api/v1/preview', $data);
|
|
||||||
|
|
||||||
|
|
||||||
$response->assertStatus(200);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user