Skip to content

Commit

Permalink
Forward is disabled by default now.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Oct 29, 2014
1 parent ff071f5 commit e1557ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 48 deletions.
15 changes: 2 additions & 13 deletions ingo/test/Ingo/Unit/MaildropTest.php
Expand Up @@ -51,9 +51,8 @@ public function testForwardKeep()
$forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(true);

$this->storage->store($forward);

$this->_enableRule(Ingo_Storage::ACTION_FORWARD);
$this->_assertScript('if( \
/^From:\s*.*/:h \
)
Expand All @@ -68,9 +67,8 @@ public function testForwardNoKeep()
$forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(false);

$this->storage->store($forward);

$this->_enableRule(Ingo_Storage::ACTION_FORWARD);
$this->_assertScript('if( \
/^From:\s*.*/:h \
)
Expand All @@ -85,9 +83,7 @@ public function testBlacklistWithFolder()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder('Junk');

$this->storage->store($bl);

$this->_assertScript('if( \
/^From:\s*.*spammer@example\.com/:h \
)
Expand All @@ -101,9 +97,7 @@ public function testBlacklistMarker()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER);

$this->storage->store($bl);

$this->_assertScript('if( \
/^From:\s*.*spammer@example\.com/:h \
)
Expand All @@ -117,9 +111,7 @@ public function testBlacklistDiscard()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(null);

$this->storage->store($bl);

$this->_assertScript('if( \
/^From:\s*.*spammer@example\.com/:h \
)
Expand All @@ -132,15 +124,12 @@ public function testWhitelist()
{
$wl = new Ingo_Storage_Whitelist(3);
$wl->setWhitelist(array('spammer@example.com'));

$this->storage->store($wl);

$this->_assertScript('if( \
/^From:\s*.*spammer@example\.com/:h \
)
exception {
to "${DEFAULT}"
}');
}

}
16 changes: 2 additions & 14 deletions ingo/test/Ingo/Unit/ProcmailTest.php
Expand Up @@ -30,7 +30,6 @@ class Ingo_Unit_ProcmailTest extends Ingo_Unit_TestBase
public function setUp()
{
parent::setUp();

$this->script = new Ingo_Script_Procmail(array(
'path_style' => 'mbox',
'skip' => array(),
Expand All @@ -51,9 +50,8 @@ public function testForwardKeep()
$forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(true);

$this->storage->store($forward);

$this->_enableRule(Ingo_Storage::ACTION_FORWARD);
$this->_assertScript(':0 c
{
:0
Expand Down Expand Up @@ -84,9 +82,8 @@ public function testForwardNoKeep()
$forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(false);

$this->storage->store($forward);

$this->_enableRule(Ingo_Storage::ACTION_FORWARD);
$this->_assertScript(':0
{
:0
Expand Down Expand Up @@ -117,9 +114,7 @@ public function testBlacklistWithFolder()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder('Junk');

$this->storage->store($bl);

$this->_assertScript(':0
* ^From:(.*\<)?spammer@example\.com
Junk');
Expand All @@ -130,7 +125,6 @@ public function testBlacklistMarker()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER);

$this->storage->store($bl);
$this->_assertScript(':0
* ^From:(.*\<)?spammer@example\.com
Expand All @@ -142,7 +136,6 @@ public function testBlacklistDiscard()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(null);

$this->storage->store($bl);
$this->_assertScript(':0
* ^From:(.*\<)?spammer@example\.com
Expand All @@ -153,7 +146,6 @@ public function testWhitelist()
{
$wl = new Ingo_Storage_Whitelist(3);
$wl->setWhitelist(array('spammer@example.com'));

$this->storage->store($wl);
$this->_assertScript(':0
* ^From:(.*\<)?spammer@example\.com
Expand All @@ -166,7 +158,6 @@ public function testVacationDisabled()
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");

$this->storage->store($vacation);
$this->_assertScript('');
}
Expand All @@ -177,10 +168,8 @@ public function testVacationEnabled()
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");

$this->storage->store($vacation);
$this->_enableRule(Ingo_Storage::ACTION_VACATION);

$this->_assertScript(':0
{
:0
Expand Down Expand Up @@ -210,5 +199,4 @@ public function testVacationEnabled()
}
}');
}

}
24 changes: 3 additions & 21 deletions ingo/test/Ingo/Unit/SieveTest.php
Expand Up @@ -30,7 +30,6 @@ class Ingo_Unit_SieveTest extends Ingo_Unit_TestBase
public function setUp()
{
parent::setUp();

$this->script = new Ingo_Script_Sieve(array(
'date_format' => '%x',
'skip' => array(),
Expand All @@ -52,9 +51,8 @@ public function testForwardKeep()
$forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(true);

$this->storage->store($forward);

$this->_enableRule(Ingo_Storage::ACTION_FORWARD);
$this->_assertScript('if true {
redirect "joefabetes@example.com";
}
Expand All @@ -69,9 +67,8 @@ public function testForwardNoKeep()
$forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(false);

$this->storage->store($forward);

$this->_enableRule(Ingo_Storage::ACTION_FORWARD);
$this->_assertScript('if true {
redirect "joefabetes@example.com";
stop;
Expand All @@ -83,9 +80,7 @@ public function testBlacklistMarker()
$bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER);

$this->storage->store($bl);

$this->_assertScript('require "imap4flags";
if address :all :comparator "i;ascii-casemap" :is ["From", "Sender", "Resent-From"] "spammer@example.com" {
addflag ["\\\\Deleted"];
Expand All @@ -99,9 +94,7 @@ public function testWhitelist()
{
$wl = new Ingo_Storage_Whitelist(3);
$wl->setWhitelist(array('spammer@example.com'));

$this->storage->store($wl);

$this->_assertScript('if address :all :comparator "i;ascii-casemap" :is ["From", "Sender", "Resent-From"] "spammer@example.com" {
keep;
stop;
Expand All @@ -114,9 +107,7 @@ public function testVacationDisabled()
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");

$this->storage->store($vacation);

$this->_assertScript('');
}

Expand All @@ -126,11 +117,8 @@ public function testVacationEnabled()
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");

$this->storage->store($vacation);

$this->_enableRule(Ingo_Storage::ACTION_VACATION);

$this->_assertScript('require ["vacation", "regex"];
if allof ( not exists "list-help", not exists "list-unsubscribe", not exists "list-subscribe", not exists "list-owner", not exists "list-post", not exists "list-archive", not exists "list-id", not exists "Mailing-List", not header :comparator "i;ascii-casemap" :is "Precedence" ["list", "bulk", "junk"], not header :comparator "i;ascii-casemap" :matches "To" "Multiple recipients of*" ) {
vacation :days 7 :addresses "from@example.com" :subject "Subject" "Because I don\'t like working!";
Expand All @@ -142,27 +130,21 @@ public function testSpamDisabled()
$spam = new Ingo_Storage_Spam();
$spam->setSpamLevel(7);
$spam->setSpamFolder("Junk");

$this->storage->store($spam);

$this->_assertScript('');
}

function testSpamEnabled()
public function testSpamEnabled()
{
$spam = new Ingo_Storage_Spam();
$spam->setSpamLevel(7);
$spam->setSpamFolder("Junk");

$this->storage->store($spam);

$this->_enableRule(Ingo_Storage::ACTION_SPAM);

$this->_assertScript('require "fileinto";
if header :comparator "i;ascii-casemap" :contains "X-Spam-Level" "*******" {
fileinto "Junk";
stop;
}');
}

}

0 comments on commit e1557ce

Please sign in to comment.