Small improvements.
This commit is contained in:
parent
c403a5e82c
commit
1d162c5da3
2 changed files with 72 additions and 81 deletions
|
@ -37,7 +37,7 @@ class SettingTest < TestCase
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 4,
|
:value => 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
|
@ -51,10 +51,6 @@ class SettingTest < TestCase
|
||||||
:value => 'no',
|
:value => 'no',
|
||||||
:match_result => false,
|
:match_result => false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
:execute => 'wait',
|
|
||||||
:value => 1,
|
|
||||||
},
|
|
||||||
|
|
||||||
# set no
|
# set no
|
||||||
{
|
{
|
||||||
|
@ -68,7 +64,7 @@ class SettingTest < TestCase
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 2,
|
:value => 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
|
@ -100,7 +96,7 @@ class SettingTest < TestCase
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 2,
|
:value => 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
|
@ -132,7 +128,7 @@ class SettingTest < TestCase
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 2,
|
:value => 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'match',
|
:execute => 'match',
|
||||||
|
|
|
@ -3,16 +3,6 @@ require 'test_helper'
|
||||||
|
|
||||||
class EmailProcessTest < ActiveSupport::TestCase
|
class EmailProcessTest < ActiveSupport::TestCase
|
||||||
test 'process simple' do
|
test 'process simple' do
|
||||||
|
|
||||||
# needed to check correct behavior
|
|
||||||
Group.create_if_not_exists(
|
|
||||||
:id => 2,
|
|
||||||
:name => 'Twitter',
|
|
||||||
:note => 'All Tweets.',
|
|
||||||
:updated_by_id => 1,
|
|
||||||
:created_by_id => 1
|
|
||||||
)
|
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
{
|
{
|
||||||
:data => 'From: me@example.com
|
:data => 'From: me@example.com
|
||||||
|
@ -31,7 +21,7 @@ Subject: äöü some subject
|
||||||
Some Textäöü",
|
Some Textäöü",
|
||||||
:trusted => false,
|
:trusted => false,
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'äöü some subject',
|
:title => 'äöü some subject',
|
||||||
|
@ -51,16 +41,16 @@ Subject: äöü some subject
|
||||||
|
|
||||||
Some Textäöü".encode("ISO-8859-1"),
|
Some Textäöü".encode("ISO-8859-1"),
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => '', # should be äöü some subject, but can not be parsed from mime tools
|
:title => '', # should be äöü some subject, but can not be parsed from mime tools
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => 'Some Textäöü',
|
:body => 'Some Textäöü',
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -127,15 +117,15 @@ Subject: Subject: =?utf-8?B?44CQ5LiT5Lia5Li65oKo5rOo5YaM6aaZ5riv5Y+K5rW35aSW5YWs
|
||||||
Some Text",
|
Some Text",
|
||||||
:trusted => false,
|
:trusted => false,
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => '【专业为您注册香港及海外公司(好处多多)】 ',
|
:title => '【专业为您注册香港及海外公司(好处多多)】 ',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => 'Some Text',
|
:body => 'Some Text',
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -144,11 +134,11 @@ Some Text",
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'World Best DRUGS Mall For a Reasonable Price.',
|
:title => 'World Best DRUGS Mall For a Reasonable Price.',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => '_________________________________________________________________________________Please beth saw his head
|
:body => '_________________________________________________________________________________Please beth saw his head
|
||||||
|
|
||||||
92hH3ÿoI221G1¿iH16u-2◊NQ422U1awAq¹JLZμ2IicgT1ζ2Y7⊆t 63‘M236E2Ý→DA2†I048CvJ9A↑3iTc4ÉIΥvXO502N1FJSð1r 154F1HPO11CRxZp tLîT9öXH1b3Es1W mN2Bg3õEbPŒS2fτTóY4 sU2P2ζΔRFkcI21™CÓZ3EΛRq!Cass is good to ask what that
|
92hH3ÿoI221G1¿iH16u-2◊NQ422U1awAq¹JLZμ2IicgT1ζ2Y7⊆t 63‘M236E2Ý→DA2†I048CvJ9A↑3iTc4ÉIΥvXO502N1FJSð1r 154F1HPO11CRxZp tLîT9öXH1b3Es1W mN2Bg3õEbPŒS2fτTóY4 sU2P2ζΔRFkcI21™CÓZ3EΛRq!Cass is good to ask what that
|
||||||
|
|
||||||
|
@ -219,9 +209,9 @@ Homegrown dandelions by herself into her lips. Such an excuse to stop thinking a
|
||||||
[2] http://www.avast.com/
|
[2] http://www.avast.com/
|
||||||
[3] http://www.avast.com/
|
[3] http://www.avast.com/
|
||||||
',
|
',
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -230,11 +220,11 @@ Homegrown dandelions by herself into her lips. Such an excuse to stop thinking a
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.',
|
:title => 'P..E..N-I..S__-E N L A R-G E-M..E..N T-___P..I-L-L..S...Info.',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:body => "Puzzled by judith bronte dave. Melvin will want her way through with.
|
:body => "Puzzled by judith bronte dave. Melvin will want her way through with.
|
||||||
Continued adam helped charlie cried. Soon joined the master bathroom. Grinned adam rubbed his arms she nodded.
|
Continued adam helped charlie cried. Soon joined the master bathroom. Grinned adam rubbed his arms she nodded.
|
||||||
Freemont and they talked with beppe.
|
Freemont and they talked with beppe.
|
||||||
Thinking of bed and whenever adam.
|
Thinking of bed and whenever adam.
|
||||||
|
@ -251,23 +241,23 @@ Freemont and pulling out several minutes.
|
||||||
|
|
||||||
[1] http://аоск.рф?jmlfwnwe&ucwkiyyc
|
[1] http://аоск.рф?jmlfwnwe&ucwkiyyc
|
||||||
",
|
",
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:data => IO.read('test/fixtures/mail23.box'),
|
:data => IO.read('test/fixtures/mail23.box'),
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => '',
|
:title => '',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:from => 'marketingmanager@nthcpghana.com',
|
:from => 'marketingmanager@nthcpghana.com',
|
||||||
:body => '»ú·¿»·¾³·¨¹æ
|
:body => '»ú·¿»·¾³·¨¹æ
|
||||||
Message-ID: <20140911055224675615@nthcpghana.com>
|
Message-ID: <20140911055224675615@nthcpghana.com>
|
||||||
From: =?utf-8?B?6IOh5qW35ZKM?= <marketingmanager@nthcpghana.com>
|
From: =?utf-8?B?6IOh5qW35ZKM?= <marketingmanager@nthcpghana.com>
|
||||||
To: <spviex@126.com>,
|
To: <spviex@126.com>,
|
||||||
|
@ -1862,9 +1852,9 @@ AElFTkSuQmCC
|
||||||
------=_NextPart_000_0FA8_01BB04D8.188AE890--
|
------=_NextPart_000_0FA8_01BB04D8.188AE890--
|
||||||
|
|
||||||
',
|
',
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1897,13 +1887,13 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '3 high',
|
:priority => '3 high',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:sender => 'System',
|
:sender => 'System',
|
||||||
:type => 'phone',
|
:type => 'phone',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1927,13 +1917,13 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => false,
|
:internal => false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1942,14 +1932,19 @@ Some Text',
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'process with postmaster filter' do
|
test 'process with postmaster filter' do
|
||||||
group = Group.create_if_not_exists(
|
group1 = Group.create_if_not_exists(
|
||||||
:name => 'Test Group',
|
:name => 'Test Group1',
|
||||||
|
:created_by_id => 1,
|
||||||
|
:updated_by_id => 1,
|
||||||
|
)
|
||||||
|
group2 = Group.create_if_not_exists(
|
||||||
|
:name => 'Test Group2',
|
||||||
:created_by_id => 1,
|
:created_by_id => 1,
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
)
|
)
|
||||||
PostmasterFilter.destroy_all
|
PostmasterFilter.destroy_all
|
||||||
PostmasterFilter.create(
|
PostmasterFilter.create(
|
||||||
:name => 'not used',
|
:name => 'not used',
|
||||||
:match => {
|
:match => {
|
||||||
:from => 'nobody@example.com',
|
:from => 'nobody@example.com',
|
||||||
},
|
},
|
||||||
|
@ -1962,12 +1957,12 @@ Some Text',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
)
|
)
|
||||||
PostmasterFilter.create(
|
PostmasterFilter.create(
|
||||||
:name => 'used',
|
:name => 'used',
|
||||||
:match => {
|
:match => {
|
||||||
:from => 'me@example.com',
|
:from => 'me@example.com',
|
||||||
},
|
},
|
||||||
:perform => {
|
:perform => {
|
||||||
'X-Zammad-Ticket-group_id' => group.id,
|
'X-Zammad-Ticket-group_id' => group1.id,
|
||||||
'x-Zammad-Article-Internal' => true,
|
'x-Zammad-Article-Internal' => true,
|
||||||
},
|
},
|
||||||
:channel => 'email',
|
:channel => 'email',
|
||||||
|
@ -1976,12 +1971,12 @@ Some Text',
|
||||||
:updated_by_id => 1,
|
:updated_by_id => 1,
|
||||||
)
|
)
|
||||||
PostmasterFilter.create(
|
PostmasterFilter.create(
|
||||||
:name => 'used x-any-recipient',
|
:name => 'used x-any-recipient',
|
||||||
:match => {
|
:match => {
|
||||||
'x-any-recipient' => 'any@example.com',
|
'x-any-recipient' => 'any@example.com',
|
||||||
},
|
},
|
||||||
:perform => {
|
:perform => {
|
||||||
'X-Zammad-Ticket-group_id' => 2,
|
'X-Zammad-Ticket-group_id' => group2.id,
|
||||||
'x-Zammad-Article-Internal' => true,
|
'x-Zammad-Article-Internal' => true,
|
||||||
},
|
},
|
||||||
:channel => 'email',
|
:channel => 'email',
|
||||||
|
@ -2000,14 +1995,14 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:group => group.name,
|
:group => group1.name,
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -2022,14 +2017,14 @@ Some Text',
|
||||||
:success => true,
|
:success => true,
|
||||||
:result => {
|
:result => {
|
||||||
0 => {
|
0 => {
|
||||||
:group => 'Twitter',
|
:group => group2.name,
|
||||||
:priority => '2 normal',
|
:priority => '2 normal',
|
||||||
:title => 'some subject',
|
:title => 'some subject',
|
||||||
},
|
},
|
||||||
1 => {
|
1 => {
|
||||||
:sender => 'Customer',
|
:sender => 'Customer',
|
||||||
:type => 'email',
|
:type => 'email',
|
||||||
:internal => true,
|
:internal => true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue