Page MenuHomePhorge

D2827.1742007584.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D2827.1742007584.diff

diff --git a/src/tests/Feature/Stories/GreylistTest.php b/src/tests/Feature/Stories/GreylistTest.php
--- a/src/tests/Feature/Stories/GreylistTest.php
+++ b/src/tests/Feature/Stories/GreylistTest.php
@@ -171,20 +171,6 @@
// public function testWhitelistUpdate() {}
- public function testNew()
- {
- $data = [
- 'sender' => 'someone@sender.domain',
- 'recipient' => $this->domainOwner->email,
- 'client_address' => $this->clientAddress,
- 'client_name' => 'some.mx'
- ];
-
- $response = $this->post('/api/webhooks/policy/greylist', $data);
-
- $response->assertStatus(403);
- }
-
public function testRetry()
{
$connect = Greylist\Connect::create(
@@ -214,7 +200,7 @@
$this->assertFalse($request->shouldDefer());
}
- public function testInvalidDomain()
+ public function testInvalidRecipient()
{
$connect = Greylist\Connect::create(
[
@@ -240,32 +226,6 @@
$this->assertTrue($request->shouldDefer());
}
- public function testInvalidUser()
- {
- $connect = Greylist\Connect::create(
- [
- 'sender_local' => 'someone',
- 'sender_domain' => 'sender.domain',
- 'recipient_hash' => hash('sha256', $this->domainOwner->email),
- 'recipient_id' => 1234,
- 'recipient_type' => \App\User::class,
- 'connect_count' => 1,
- 'net_id' => $this->net->id,
- 'net_type' => \App\IP4Net::class
- ]
- );
-
- $request = new Greylist\Request(
- [
- 'sender' => 'someone@sender.domain',
- 'recipient' => 'not.someone@that.exists',
- 'client_address' => $this->clientAddress
- ]
- );
-
- $this->assertTrue($request->shouldDefer());
- }
-
public function testUserDisabled()
{
$connect = Greylist\Connect::create(
@@ -426,4 +386,49 @@
}
}
}
+
+ public function testControllerNew()
+ {
+ $data = [
+ 'sender' => 'someone@sender.domain',
+ 'recipient' => $this->domainOwner->email,
+ 'client_address' => $this->clientAddress,
+ 'client_name' => 'some.mx'
+ ];
+
+ $response = $this->post('/api/webhooks/policy/greylist', $data);
+
+ $response->assertStatus(403);
+ }
+
+ public function testControllerNotNew()
+ {
+ $connect = Greylist\Connect::create(
+ [
+ 'sender_local' => 'someone',
+ 'sender_domain' => 'sender.domain',
+ 'recipient_hash' => hash('sha256', $this->domainOwner->email),
+ 'recipient_id' => $this->domainOwner->id,
+ 'recipient_type' => \App\User::class,
+ 'connect_count' => 1,
+ 'net_id' => $this->net->id,
+ 'net_type' => \App\IP4Net::class
+ ]
+ );
+
+ $connect->created_at = \Carbon\Carbon::now()->subMinutes(6);
+ $connect->save();
+
+ $data = [
+ 'sender' => 'someone@sender.domain',
+ 'recipient' => $this->domainOwner->email,
+ 'client_address' => $this->clientAddress,
+ 'client_name' => 'some.mx'
+ ];
+
+ $response = $this->post('/api/webhooks/policy/greylist', $data);
+
+ $response->assertStatus(200);
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 3:59 AM (9 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11312316
Default Alt Text
D2827.1742007584.diff (3 KB)

Event Timeline