mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-03-30 18:26:14 +02:00
Fix unit tests
This commit is contained in:
parent
1433e7b550
commit
baa9658e46
@ -43,7 +43,7 @@ class TwoFAccount extends Model
|
||||
public function getIconAttribute($value)
|
||||
{
|
||||
if (\App::environment('testing') == false) {
|
||||
if( !Storage::exists('public/icons/' . pathinfo($value)['basename']) ) {
|
||||
if( !Storage::exists('public/icons/' . $value) ) {
|
||||
|
||||
return '';
|
||||
}
|
||||
@ -62,7 +62,7 @@ public function getIconAttribute($value)
|
||||
public function setIconAttribute($value)
|
||||
{
|
||||
|
||||
if( !Storage::exists('public/icons/' . pathinfo($value)['basename']) ) {
|
||||
if( !Storage::exists('public/icons/' . $value) && \App::environment('testing') == false ) {
|
||||
|
||||
$this->attributes['icon'] = '';
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ public function testTOTPgeneration()
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($this->user, 'api')
|
||||
->json('GET', '/api/twofaccounts/' . $twofaccount->id . '/totp')
|
||||
->json('GET', '/api/twofaccounts/' . $twofaccount->id . '/otp')
|
||||
->assertStatus(200)
|
||||
->assertJsonStructure([
|
||||
'totp',
|
||||
'otp',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -161,7 +161,6 @@ public function testTwoFAccountUpdate()
|
||||
->json('PUT', '/api/twofaccounts/' . $twofaccount->id, [
|
||||
'service' => 'testUpdate',
|
||||
'account' => 'testUpdate@test.com',
|
||||
'uri' => 'testUpdate',
|
||||
'icon' => 'testUpdate.png',
|
||||
])
|
||||
->assertStatus(200)
|
||||
@ -169,7 +168,7 @@ public function testTwoFAccountUpdate()
|
||||
'id' => 1,
|
||||
'service' => 'testUpdate',
|
||||
'account' => 'testUpdate@test.com',
|
||||
'uri' => 'testUpdate',
|
||||
'uri' => $twofaccount->uri,
|
||||
'icon' => 'testUpdate.png',
|
||||
]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user