Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Stories/SenderPolicyFrameworkTest.php
<?php | <?php | ||||
namespace Tests\Feature\Stories; | namespace Tests\Feature\Stories; | ||||
use Tests\TestCase; | use Tests\TestCase; | ||||
class SenderPolicyFrameworkTest extends TestCase | class SenderPolicyFrameworkTest extends TestCase | ||||
{ | { | ||||
public function setUp() | public function setUp(): void | ||||
{ | { | ||||
parent::setUp(); | parent::setUp(); | ||||
$this->useServicesUrl(); | $this->useServicesUrl(); | ||||
} | } | ||||
public function tearDown() | public function tearDown(): void | ||||
{ | { | ||||
$this->useNormalUrl(); | $this->useNormalUrl(); | ||||
parent::tearDown(); | parent::tearDown(); | ||||
} | } | ||||
public function testSenderFailv4() | public function testSenderFailv4() | ||||
{ | { | ||||
$data = [ | $data = [ | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | public function testSenderSoftfail() | ||||
'sender' => 'sender@spf-fail.kolab.org', | 'sender' => 'sender@spf-fail.kolab.org', | ||||
'client_name' => 'mx.kolabnow.com', | 'client_name' => 'mx.kolabnow.com', | ||||
'client_address' => '212.103.80.148', | 'client_address' => '212.103.80.148', | ||||
'recipient' => $this->domainOwner->email | 'recipient' => $this->domainOwner->email | ||||
]; | ]; | ||||
$response = $this->post('/api/webhooks/policy/spf', $data); | $response = $this->post('/api/webhooks/policy/spf', $data); | ||||
$response->assertStatus(200); | $response->assertStatus(403); | ||||
} | } | ||||
public function testSenderTemperror() | public function testSenderTemperror() | ||||
{ | { | ||||
$data = [ | $data = [ | ||||
'instance' => 'test.local.instance', | 'instance' => 'test.local.instance', | ||||
'protocol_state' => 'RCPT', | 'protocol_state' => 'RCPT', | ||||
'sender' => 'sender@spf-temperror.kolab.org', | 'sender' => 'sender@spf-temperror.kolab.org', | ||||
'client_name' => 'mx.kolabnow.com', | 'client_name' => 'mx.kolabnow.com', | ||||
'client_address' => '212.103.80.148', | 'client_address' => '212.103.80.148', | ||||
'recipient' => $this->domainOwner->email | 'recipient' => $this->domainOwner->email | ||||
]; | ]; | ||||
$response = $this->post('/api/webhooks/policy/spf', $data); | $response = $this->post('/api/webhooks/policy/spf', $data); | ||||
$response->assertStatus(403); | $response->assertStatus(200); | ||||
} | } | ||||
public function testSenderRelayPolicyHeloExactNegative() | public function testSenderRelayPolicyHeloExactNegative() | ||||
{ | { | ||||
$data = [ | $data = [ | ||||
'instance' => 'test.local.instance', | 'instance' => 'test.local.instance', | ||||
'protocol_state' => 'RCPT', | 'protocol_state' => 'RCPT', | ||||
'sender' => 'sender@amazon.co.uk', | 'sender' => 'sender@amazon.co.uk', | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |