forked from anonaddy/anonaddy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replies to UUID aliases now come from the alias
- Loading branch information
1 parent
a59fdf3
commit f2ff02e
Showing
4 changed files
with
59 additions
and
6 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 |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
use App\Recipient; | ||
use App\User; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Support\Facades\Cache; | ||
use Illuminate\Support\Facades\Mail; | ||
use Illuminate\Support\Facades\Notification; | ||
use Tests\TestCase; | ||
|
@@ -896,6 +897,50 @@ public function it_can_send_near_bandwidth_limit_notification() | |
); | ||
} | ||
|
||
/** @test */ | ||
public function it_does_not_send_near_bandwidth_limit_notification_more_than_once_per_day() | ||
{ | ||
Notification::fake(); | ||
|
||
Notification::assertNothingSent(); | ||
|
||
Cache::put("user:{$this->user->username}:near-bandwidth", now()->toDateTimeString(), now()->addDay()); | ||
|
||
$this->user->update(['bandwidth' => 9485760]); | ||
|
||
$this->artisan( | ||
'anonaddy:receive-email', | ||
[ | ||
'file' => base_path('tests/emails/email.eml'), | ||
'--sender' => '[email protected]', | ||
'--recipient' => ['[email protected]'], | ||
'--local_part' => ['ebay'], | ||
'--extension' => [''], | ||
'--domain' => ['johndoe.anonaddy.com'], | ||
'--size' => '1000' | ||
] | ||
)->assertExitCode(0); | ||
|
||
$this->assertDatabaseHas('aliases', [ | ||
'email' => 'ebay@johndoe.'.config('anonaddy.domain'), | ||
'local_part' => 'ebay', | ||
'domain' => 'johndoe.'.config('anonaddy.domain'), | ||
'emails_forwarded' => 1, | ||
'emails_blocked' => 0 | ||
]); | ||
$this->assertEquals(1, $this->user->aliases()->count()); | ||
$this->assertDatabaseHas('users', [ | ||
'id' => $this->user->id, | ||
'username' => 'johndoe', | ||
'bandwidth' => '9486760' | ||
]); | ||
|
||
Notification::assertNotSentTo( | ||
$this->user, | ||
NearBandwidthLimit::class | ||
); | ||
} | ||
|
||
/** @test */ | ||
public function it_can_forward_email_from_file_for_all_domains() | ||
{ | ||
|