mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-05-02 13:24:35 +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)
|
public function getIconAttribute($value)
|
||||||
{
|
{
|
||||||
if (\App::environment('testing') == false) {
|
if (\App::environment('testing') == false) {
|
||||||
if( !Storage::exists('public/icons/' . pathinfo($value)['basename']) ) {
|
if( !Storage::exists('public/icons/' . $value) ) {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ public function getIconAttribute($value)
|
|||||||
public function setIconAttribute($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'] = '';
|
$this->attributes['icon'] = '';
|
||||||
}
|
}
|
||||||
|
@ -140,10 +140,10 @@ public function testTOTPgeneration()
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$response = $this->actingAs($this->user, 'api')
|
$response = $this->actingAs($this->user, 'api')
|
||||||
->json('GET', '/api/twofaccounts/' . $twofaccount->id . '/totp')
|
->json('GET', '/api/twofaccounts/' . $twofaccount->id . '/otp')
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->assertJsonStructure([
|
->assertJsonStructure([
|
||||||
'totp',
|
'otp',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +161,6 @@ public function testTwoFAccountUpdate()
|
|||||||
->json('PUT', '/api/twofaccounts/' . $twofaccount->id, [
|
->json('PUT', '/api/twofaccounts/' . $twofaccount->id, [
|
||||||
'service' => 'testUpdate',
|
'service' => 'testUpdate',
|
||||||
'account' => 'testUpdate@test.com',
|
'account' => 'testUpdate@test.com',
|
||||||
'uri' => 'testUpdate',
|
|
||||||
'icon' => 'testUpdate.png',
|
'icon' => 'testUpdate.png',
|
||||||
])
|
])
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
@ -169,7 +168,7 @@ public function testTwoFAccountUpdate()
|
|||||||
'id' => 1,
|
'id' => 1,
|
||||||
'service' => 'testUpdate',
|
'service' => 'testUpdate',
|
||||||
'account' => 'testUpdate@test.com',
|
'account' => 'testUpdate@test.com',
|
||||||
'uri' => 'testUpdate',
|
'uri' => $twofaccount->uri,
|
||||||
'icon' => 'testUpdate.png',
|
'icon' => 'testUpdate.png',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user