mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-23 23:49:53 +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 Tests\TestCase;
|
||||
use Tests\Classes\LocalFile;
|
||||
use App\Classes\Options;
|
||||
|
||||
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
|
||||
*/
|
||||
public function testDecodeValidQrcode()
|
||||
{
|
||||
{
|
||||
Options::store(array('useBasicQrcodeReader' => true));
|
||||
|
||||
$file = LocalFile::fake()->validQrcode();
|
||||
|
||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||
|
Loading…
Reference in New Issue
Block a user