mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-01-11 16:58:58 +01:00
Complete and update tests
This commit is contained in:
parent
20d77ad85f
commit
1c5f12d691
@ -8,6 +8,7 @@
|
|||||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Tests\Classes\LocalFile;
|
use Tests\Classes\LocalFile;
|
||||||
|
use App\Classes\Options;
|
||||||
|
|
||||||
class QrcodeTest extends TestCase
|
class QrcodeTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -50,13 +51,42 @@ public function testDecodeInvalidQrcode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test Decode a qrcode via API
|
||||||
|
*
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function testDecodeValidUri()
|
||||||
|
{
|
||||||
|
$response = $this->json('POST', '/api/qrcode/decode', [
|
||||||
|
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVIRBGY7UIW'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->assertStatus(200)
|
||||||
|
->assertJsonFragment([
|
||||||
|
'service' => 'test@test.com',
|
||||||
|
'account' => '',
|
||||||
|
'options' => [
|
||||||
|
'algorithm' => 'sha1',
|
||||||
|
'digits' => 6,
|
||||||
|
'epoch' => 0,
|
||||||
|
'period' => 30,
|
||||||
|
'secret' => 'A4GRFHVIRBGY7UIW'
|
||||||
|
],
|
||||||
|
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVIRBGY7UIW'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test Decode a qrcode via API
|
* test Decode a qrcode via API
|
||||||
*
|
*
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function testDecodeValidQrcode()
|
public function testDecodeValidQrcode()
|
||||||
{
|
{
|
||||||
|
Options::store(array('useBasicQrcodeReader' => true));
|
||||||
|
|
||||||
$file = LocalFile::fake()->validQrcode();
|
$file = LocalFile::fake()->validQrcode();
|
||||||
|
|
||||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||||
|
Loading…
Reference in New Issue
Block a user