Fixed email process tests.

This commit is contained in:
Martin Edenhofer 2016-05-23 20:04:30 +02:00
parent 0e150fccd0
commit 6fcdb9c0ef
2 changed files with 7 additions and 7 deletions

View file

@ -4,6 +4,7 @@ require 'test_helper'
class EmailPostmasterTest < ActiveSupport::TestCase class EmailPostmasterTest < ActiveSupport::TestCase
test 'process with postmaster filter' do test 'process with postmaster filter' do
group_default = Group.lookup(name: 'Users')
group1 = Group.create_if_not_exists( group1 = Group.create_if_not_exists(
name: 'Test Group1', name: 'Test Group1',
created_by_id: 1, created_by_id: 1,
@ -83,7 +84,7 @@ Subject: some subject
Some Text' Some Text'
parser = Channel::EmailParser.new parser = Channel::EmailParser.new
ticket, article, user = parser.process( { trusted: false }, data ) ticket, article, user = parser.process({ group_id: group_default.id, trusted: false }, data)
assert_equal('Test Group1', ticket.group.name) assert_equal('Test Group1', ticket.group.name)
assert_equal('2 normal', ticket.priority.name) assert_equal('2 normal', ticket.priority.name)
assert_equal('some subject', ticket.title) assert_equal('some subject', ticket.title)
@ -100,7 +101,7 @@ Subject: some subject
Some Text' Some Text'
parser = Channel::EmailParser.new parser = Channel::EmailParser.new
ticket, article, user = parser.process( { trusted: false }, data ) ticket, article, user = parser.process({ group_id: group_default.id, trusted: false }, data)
assert_equal('Test Group2', ticket.group.name) assert_equal('Test Group2', ticket.group.name)
assert_equal('2 normal', ticket.priority.name) assert_equal('2 normal', ticket.priority.name)
@ -144,7 +145,7 @@ Subject: some subject2
Some Text' Some Text'
parser = Channel::EmailParser.new parser = Channel::EmailParser.new
ticket, article, user = parser.process( { trusted: false }, data ) ticket, article, user = parser.process({ group_id: group_default.id, trusted: false }, data)
assert_equal('Test Group2', ticket.group.name) assert_equal('Test Group2', ticket.group.name)
assert_equal('1 low', ticket.priority.name) assert_equal('1 low', ticket.priority.name)
@ -189,7 +190,7 @@ Subject: some subject - no selector
Some Text' Some Text'
parser = Channel::EmailParser.new parser = Channel::EmailParser.new
ticket, article, user = parser.process( { trusted: false }, data ) ticket, article, user = parser.process({ group_id: group_default.id, trusted: false }, data)
assert_equal('Users', ticket.group.name) assert_equal('Users', ticket.group.name)
assert_equal('2 normal', ticket.priority.name) assert_equal('2 normal', ticket.priority.name)
@ -229,7 +230,7 @@ Subject: follow up with create post master filter test
Some Text' Some Text'
parser = Channel::EmailParser.new parser = Channel::EmailParser.new
ticket, article, user = parser.process( { trusted: false }, data ) ticket, article, user = parser.process({ group_id: group_default.id, trusted: false }, data)
assert_equal(group2.name, ticket.group.name) assert_equal(group2.name, ticket.group.name)
assert_equal('2 normal', ticket.priority.name) assert_equal('2 normal', ticket.priority.name)
@ -253,7 +254,7 @@ Some Text"
article_count = ticket.articles.count article_count = ticket.articles.count
parser = Channel::EmailParser.new parser = Channel::EmailParser.new
ticket_followup, article, user = parser.process( { trusted: false }, data ) ticket_followup, article, user = parser.process({ group_id: group_default.id, trusted: false }, data)
# check if group is still the old one # check if group is still the old one
assert_equal(ticket.id, ticket_followup.id) assert_equal(ticket.id, ticket_followup.id)

View file

@ -2137,7 +2137,6 @@ Some Text',
] ]
process(files) process(files)
group_active_map = {}
Group.all.each {|group| Group.all.each {|group|
next if !group_active_map.key?(group.id) next if !group_active_map.key?(group.id)
group.active = group_active_map[group.id] group.active = group_active_map[group.id]