Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Feature/Controller/NGINXTest.php
Show First 20 Lines • Show All 308 Lines • ▼ Show 20 Lines | public function testRoundcubeHook(): void | ||||
$this->markTestIncomplete(); | $this->markTestIncomplete(); | ||||
} | } | ||||
/** | /** | ||||
* Test the cyrus-sasl webhook | * Test the cyrus-sasl webhook | ||||
*/ | */ | ||||
public function testCyrusSaslHook(): void | public function testCyrusSaslHook(): void | ||||
{ | { | ||||
$this->markTestIncomplete(); | $pass = \App\Utils::generatePassphrase(); | ||||
// Pass | |||||
$response = $this->postWithBody("api/webhooks/cyrus-sasl", "john kolab.org $pass"); | |||||
$response->assertStatus(200); | |||||
// Pass without realm | |||||
$response = $this->postWithBody("api/webhooks/cyrus-sasl", "john@kolab.org $pass"); | |||||
$response->assertStatus(200); | |||||
// Invalid password | |||||
$response = $this->postWithBody("api/webhooks/cyrus-sasl", "john kolab.org fail"); | |||||
$response->assertStatus(403); | |||||
$cyrusAdmin = \config('services.imap.admin_login'); | |||||
$pass = \config('services.imap.admin_password'); | |||||
// cyrus-admin Pass | |||||
machniak: This test should use password from `\config('services.imap.admin_password')`. | |||||
$response = $this->postWithBody("api/webhooks/cyrus-sasl", "$cyrusAdmin $pass"); | |||||
$response->assertStatus(200); | |||||
// cyrus-admin fail | |||||
$response = $this->postWithBody("api/webhooks/cyrus-sasl", "$cyrusAdmin fail"); | |||||
$response->assertStatus(403); | |||||
// unknown user fail | |||||
$response = $this->postWithBody("api/webhooks/cyrus-sasl", "missing@kolab.org $pass"); | |||||
$response->assertStatus(403); | |||||
} | } | ||||
} | } |
This test should use password from \config('services.imap.admin_password').