mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-12 15:07:04 +02:00
Apply Laravel Pint fixes
This commit is contained in:
@ -2,48 +2,44 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Tests\FeatureTestCase;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use Tests\Classes\LocalFile;
|
||||
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\QrCodeController
|
||||
*/
|
||||
class QrCodeControllerTest extends FeatureTestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \App\Models\User
|
||||
*/
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function setUp(): void
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->user = User::factory()->create();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_show_qrcode_returns_base64_image()
|
||||
{
|
||||
$twofaccount = TwoFAccount::factory()->create([
|
||||
'otp_type' => 'totp',
|
||||
'account' => 'account',
|
||||
'service' => 'service',
|
||||
'secret' => 'A4GRFHZVRBGY7UIW',
|
||||
'algorithm' => 'sha1',
|
||||
'digits' => 6,
|
||||
'period' => 30,
|
||||
'otp_type' => 'totp',
|
||||
'account' => 'account',
|
||||
'service' => 'service',
|
||||
'secret' => 'A4GRFHZVRBGY7UIW',
|
||||
'algorithm' => 'sha1',
|
||||
'digits' => 6,
|
||||
'period' => 30,
|
||||
'legacy_uri' => 'otpauth://hotp/service:account?secret=A4GRFHZVRBGY7UIW&issuer=service',
|
||||
]);
|
||||
|
||||
@ -53,11 +49,10 @@ class QrCodeControllerTest extends FeatureTestCase
|
||||
'qrcode',
|
||||
])
|
||||
->assertOk();
|
||||
|
||||
|
||||
$this->assertStringStartsWith('data:image/png;base64', $response->getData()->qrcode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@ -67,11 +62,10 @@ class QrCodeControllerTest extends FeatureTestCase
|
||||
->json('GET', '/api/v1/twofaccounts/1000/qrcode')
|
||||
->assertNotFound()
|
||||
->assertJsonStructure([
|
||||
'message'
|
||||
'message',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@ -82,8 +76,8 @@ class QrCodeControllerTest extends FeatureTestCase
|
||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||
->actingAs($this->user, 'api-guard')
|
||||
->json('POST', '/api/v1/qrcode/decode', [
|
||||
'qrcode' => $file,
|
||||
'inputFormat' => 'fileUpload'
|
||||
'qrcode' => $file,
|
||||
'inputFormat' => 'fileUpload',
|
||||
])
|
||||
->assertOk()
|
||||
->assertExactJson([
|
||||
@ -91,7 +85,6 @@ class QrCodeControllerTest extends FeatureTestCase
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@ -104,7 +97,6 @@ class QrCodeControllerTest extends FeatureTestCase
|
||||
->assertStatus(422);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
@ -115,12 +107,12 @@ class QrCodeControllerTest extends FeatureTestCase
|
||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||
->actingAs($this->user, 'api-guard')
|
||||
->json('POST', '/api/v1/qrcode/decode', [
|
||||
'qrcode' => $file,
|
||||
'inputFormat' => 'fileUpload'
|
||||
'qrcode' => $file,
|
||||
'inputFormat' => 'fileUpload',
|
||||
])
|
||||
->assertStatus(400)
|
||||
->assertJsonStructure([
|
||||
'message',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user