mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 11:47:53 +02:00
Complete tests
This commit is contained in:
parent
eaabe6e9e3
commit
ffd1199a28
@ -4,6 +4,7 @@ namespace Tests\Unit;
|
||||
|
||||
use App\User;
|
||||
use Tests\TestCase;
|
||||
use App\TwoFAccount;
|
||||
use App\Http\Controllers\TwoFAccountController;
|
||||
use Illuminate\Auth\Authenticatable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@ -113,6 +114,20 @@ class ApiExceptionTest extends TestCase
|
||||
*/
|
||||
public function test_HTTP_INTERNAL_SERVER_ERROR()
|
||||
{
|
||||
factory(TwoFAccount::class, 3)->create();
|
||||
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('PATCH', '/api/twofaccounts/reorder', [
|
||||
'orderedIds' => 'x'])
|
||||
->assertStatus(500)
|
||||
->assertJsonStructure([
|
||||
'message',
|
||||
'originalMessage',
|
||||
'debug'
|
||||
])
|
||||
->assertJsonFragment([
|
||||
'message' => 'Whoops, looks like something went wrong'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ class TwoFAccountTest extends TestCase
|
||||
*/
|
||||
public function testTwoFAccountIndexListing()
|
||||
{
|
||||
$twofaccount = factory(TwoFAccount::class, 3)->create();
|
||||
factory(TwoFAccount::class, 3)->create();
|
||||
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('GET', '/api/twofaccounts')
|
||||
@ -293,9 +293,7 @@ class TwoFAccountTest extends TestCase
|
||||
*/
|
||||
public function testTwoFAccountBatchDestroy()
|
||||
{
|
||||
$twofaccount = factory(TwoFAccount::class)->create();
|
||||
$twofaccount = factory(TwoFAccount::class)->create();
|
||||
$twofaccount = factory(TwoFAccount::class)->create();
|
||||
factory(TwoFAccount::class, 3)->create();
|
||||
|
||||
$ids = \Illuminate\Support\Facades\DB::table('twofaccounts')->value('id');
|
||||
|
||||
@ -305,4 +303,19 @@ class TwoFAccountTest extends TestCase
|
||||
->assertStatus(204);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* test TwoFAccounts reorder
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
public function testTwoFAccountReorder()
|
||||
{
|
||||
factory(TwoFAccount::class, 3)->create();
|
||||
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('PATCH', '/api/twofaccounts/reorder', [
|
||||
'orderedIds' => [3,2,1]])
|
||||
->assertStatus(200);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user