This repository has been archived by the owner on Jun 13, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from DarkGhostHunter/master
Fixed trait and added more tests.
- Loading branch information
Showing
4 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,22 @@ public function test_sends_recovery_email() | |
]); | ||
} | ||
|
||
public function test_sends_recovery_email_using_json() | ||
{ | ||
$notification = Notification::fake(); | ||
|
||
$this->postJson('webauthn/lost', [ | ||
'email' => '[email protected]' | ||
]) | ||
->assertSeeText(trans('larapass::recovery.sent')); | ||
|
||
$notification->assertSentTo(TestWebAuthnUser::first(), AccountRecoveryNotification::class); | ||
|
||
$this->assertDatabaseHas('web_authn_recoveries', [ | ||
'email' => '[email protected]' | ||
]); | ||
} | ||
|
||
public function test_error_if_email_invalid() | ||
{ | ||
$notification = Notification::fake(); | ||
|
@@ -137,6 +153,11 @@ public function test_error_if_email_invalid() | |
->assertRedirect(route('webauthn.lost.form')) | ||
->assertSessionHasErrors(['email']); | ||
|
||
$this->postJson('webauthn/lost', [ | ||
'email' => 'invalid' | ||
]) | ||
->assertSeeText('The given data was invalid'); | ||
|
||
$notification->assertNothingSent(); | ||
|
||
$this->assertDatabaseMissing('web_authn_recoveries', [ | ||
|
@@ -156,6 +177,11 @@ public function test_error_if_user_email_doesnt_exists() | |
->assertRedirect(route('webauthn.lost.form')) | ||
->assertSessionHasErrors(['email']); | ||
|
||
$this->postJson('webauthn/lost', [ | ||
'email' => '[email protected]' | ||
]) | ||
->assertSeeText('The given data was invalid'); | ||
|
||
$notification->assertNothingSent(); | ||
|
||
$this->assertDatabaseMissing('web_authn_recoveries', [ | ||
|
@@ -190,6 +216,11 @@ public function test_throttled_on_resend() | |
]) | ||
->assertRedirect(route('webauthn.lost.form')) | ||
->assertSessionHasErrors(['email']); | ||
|
||
$this->postJson('webauthn/lost', [ | ||
'email' => '[email protected]' | ||
]) | ||
->assertSeeText(trans('larapass::recovery.throttled')); | ||
} | ||
|
||
public function test_error_if_no_broker_is_set() | ||
|