123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855 |
- require 'test_helper'
- class TicketTriggerExtendedTest < ActiveSupport::TestCase
- setup do
- Setting.set('ticket_trigger_recursive', true)
- end
- test 'recursive trigger' do
- Trigger.create!(
- name: '1) set prio to 3 high',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'new').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '2) set state to closed',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- email_raw_string = 'From: me@example.com
- To: customer@example.com
- Subject: some new subject
- Some Text'
- ticket_p, _article_p, _user_p, _mail = Channel::EmailParser.new.process({}, email_raw_string)
- assert_equal('some new subject', ticket_p.title)
- assert_equal('Users', ticket_p.group.name)
- assert_equal('3 high', ticket_p.priority.name)
- assert_equal('closed', ticket_p.state.name)
- assert_equal(1, ticket_p.articles.count, 'ticket1.articles verify')
- end
- test 'recursive trigger - loop test' do
- Trigger.create!(
- name: '1) set prio to 3 high',
- condition: {
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '2) set prio to 1 low',
- condition: {
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s,
- },
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '3) set prio to 3 high',
- condition: {
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- email_raw_string = 'From: me@example.com
- To: customer@example.com
- Subject: some new subject
- Some Text'
- ticket_p, _article_p, _user_p, _mail = Channel::EmailParser.new.process({}, email_raw_string)
- assert_equal('some new subject', ticket_p.title)
- assert_equal('Users', ticket_p.group.name)
- assert_equal('2 normal', ticket_p.priority.name)
- assert_equal('open', ticket_p.state.name)
- assert_equal(1, ticket_p.articles.count, 'ticket1.articles verify')
- end
- test 'recursive trigger - 2 trigger will not trigger next trigger' do
- Trigger.create!(
- name: '1) set prio to 3 high',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '2) set state to open',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '3) set state to closed',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- email_raw_string = 'From: me@example.com
- To: customer@example.com
- Subject: some new subject
- Some Text'
- ticket_p, _article_p, _user_p, _mail = Channel::EmailParser.new.process({}, email_raw_string)
- assert_equal('some new subject', ticket_p.title)
- assert_equal('Users', ticket_p.group.name)
- assert_equal('3 high', ticket_p.priority.name)
- assert_equal('new', ticket_p.state.name)
- assert_equal(1, ticket_p.articles.count, 'ticket1.articles verify')
- end
- test 'recursive trigger - 2 trigger will trigger next trigger - case 1' do
- Trigger.create!(
- name: '1) set state to closed',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '2) set prio to 3 high',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '3) set state to open',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- email_raw_string = 'From: me@example.com
- To: customer@example.com
- Subject: some new subject
- Some Text'
- ticket_p, _article_p, _user_p, _mail = Channel::EmailParser.new.process({}, email_raw_string)
- assert_equal('some new subject', ticket_p.title)
- assert_equal('Users', ticket_p.group.name)
- assert_equal('3 high', ticket_p.priority.name)
- assert_equal('closed', ticket_p.state.name)
- assert_equal(1, ticket_p.articles.count, 'ticket1.articles verify')
- end
- test 'recursive trigger - 2 trigger will trigger next trigger - case 2' do
- Trigger.create!(
- name: '1) set prio to 3 high',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '2) set state to closed',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '3) set state to open',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'open').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- email_raw_string = 'From: me@example.com
- To: customer@example.com
- Subject: some new subject
- Some Text'
- ticket_p, _article_p, _user_p, _mail = Channel::EmailParser.new.process({}, email_raw_string)
- assert_equal('some new subject', ticket_p.title)
- assert_equal('Users', ticket_p.group.name)
- assert_equal('3 high', ticket_p.priority.name)
- assert_equal('closed', ticket_p.state.name)
- assert_equal(1, ticket_p.articles.count, 'ticket1.articles verify')
- end
- test 'trigger based move and verify correct agent notifications' do
- group1 = Group.create!(
- name: 'Group 1',
- active: true,
- email_address: EmailAddress.first,
- created_by_id: 1,
- updated_by_id: 1,
- )
- group2 = Group.create!(
- name: 'Group 2',
- active: true,
- email_address: EmailAddress.first,
- created_by_id: 1,
- updated_by_id: 1,
- )
- group3 = Group.create!(
- name: 'Group 3',
- active: true,
- email_address: EmailAddress.first,
- created_by_id: 1,
- updated_by_id: 1,
- )
- roles = Role.where(name: 'Agent')
- user1 = User.create!(
- login: 'trigger1@example.org',
- firstname: 'trigger1',
- lastname: 'trigger1',
- email: 'trigger1@example.org',
- password: 'some_pass',
- active: true,
- groups: [group1],
- roles: roles,
- created_by_id: 1,
- updated_by_id: 1,
- )
- user2 = User.create!(
- login: 'trigger2@example.org',
- firstname: 'trigger2',
- lastname: 'trigger2',
- email: 'trigger2@example.org',
- password: 'some_pass',
- active: true,
- groups: [group2],
- roles: roles,
- created_by_id: 1,
- updated_by_id: 1,
- )
- # trigger, move ticket created in group1 into group3 and then into group2
- Trigger.create_or_update(
- name: '1 dispatch',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.group_id' => {
- 'operator' => 'is',
- 'value' => group3.id.to_s,
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'new').id.to_s,
- },
- },
- perform: {
- 'ticket.group_id' => {
- 'value' => group2.id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create_or_update(
- name: '2 dispatch',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'new').id.to_s,
- },
- },
- perform: {
- 'ticket.group_id' => {
- 'value' => group3.id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- ticket1 = Ticket.create!(
- title: '123',
- group: group1,
- customer_id: 2,
- state: Ticket::State.lookup(name: 'new'),
- priority: Ticket::Priority.lookup(name: '2 normal'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- assert(ticket1)
- assert_equal(ticket1.title, '123')
- assert_equal(ticket1.group.name, group1.name)
- assert_equal(ticket1.state.name, 'new')
- Ticket::Article.create!(
- ticket_id: ticket1.id,
- from: 'some_sender@example.com',
- to: 'some_recipient@example.com',
- subject: 'some subject',
- message_id: 'some@id',
- body: 'some message',
- internal: false,
- sender: Ticket::Article::Sender.find_by(name: 'Customer'),
- type: Ticket::Article::Type.find_by(name: 'email'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- # verfiy if agent1 got no notifcation
- assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, user1, 'email'), ticket1.id)
- # verfiy if agent2 got no notifcation
- assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, user2, 'email'), ticket1.id)
- TransactionDispatcher.commit
- Scheduler.worker(true)
- ticket1.reload
- assert_equal('123', ticket1.title)
- assert_equal(group2.name, ticket1.group.name)
- assert_equal('new', ticket1.state.name)
- assert_equal('2 normal', ticket1.priority.name)
- assert_equal(1, ticket1.articles.count)
- # verfiy if agent1 got no notifcation
- assert_equal(0, NotificationFactory::Mailer.already_sent?(ticket1, user1, 'email'), ticket1.id)
- # verfiy if agent2 got notifcation
- assert_equal(1, NotificationFactory::Mailer.already_sent?(ticket1, user2, 'email'), ticket1.id)
- end
- test 'recursive trigger loop check' do
- Setting.set('ticket_trigger_recursive_max_loop', 2)
- Trigger.create!(
- name: '000',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s,
- },
- },
- perform: {
- 'ticket.state_id' => {
- 'value' => Ticket::State.lookup(name: 'closed').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '001',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '1 low').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: '002',
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.priority_id' => {
- 'operator' => 'is',
- 'value' => Ticket::Priority.lookup(name: '2 normal').id.to_s,
- },
- },
- perform: {
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- group1 = Group.find_by(name: 'Users')
- ticket1 = Ticket.create!(
- title: '123',
- group: group1,
- customer_id: 2,
- state: Ticket::State.lookup(name: 'new'),
- priority: Ticket::Priority.lookup(name: '2 normal'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- assert(ticket1)
- assert_equal(ticket1.title, '123')
- assert_equal(ticket1.group.name, group1.name)
- assert_equal(ticket1.state.name, 'new')
- Ticket::Article.create!(
- ticket_id: ticket1.id,
- from: 'some_sender@example.com',
- to: 'some_recipient@example.com',
- subject: 'some subject',
- message_id: 'some@id',
- body: 'some message',
- internal: false,
- sender: Ticket::Article::Sender.find_by(name: 'Customer'),
- type: Ticket::Article::Type.find_by(name: 'email'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- TransactionDispatcher.commit
- Scheduler.worker(true)
- ticket1.reload
- assert_equal('123', ticket1.title)
- assert_equal('new', ticket1.state.name)
- assert_equal('1 low', ticket1.priority.name)
- assert_equal(1, ticket1.articles.count)
- Setting.set('ticket_trigger_recursive_max_loop', 3)
- ticket1 = Ticket.create!(
- title: '123',
- group: group1,
- customer_id: 2,
- state: Ticket::State.lookup(name: 'new'),
- priority: Ticket::Priority.lookup(name: '2 normal'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- assert(ticket1)
- assert_equal(ticket1.title, '123')
- assert_equal(ticket1.group.name, group1.name)
- assert_equal(ticket1.state.name, 'new')
- Ticket::Article.create!(
- ticket_id: ticket1.id,
- from: 'some_sender@example.com',
- to: 'some_recipient@example.com',
- subject: 'some subject',
- message_id: 'some@id',
- body: 'some message',
- internal: false,
- sender: Ticket::Article::Sender.find_by(name: 'Customer'),
- type: Ticket::Article::Type.find_by(name: 'email'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- TransactionDispatcher.commit
- Scheduler.worker(true)
- ticket1.reload
- assert_equal('123', ticket1.title)
- assert_equal('closed', ticket1.state.name)
- assert_equal('1 low', ticket1.priority.name)
- assert_equal(1, ticket1.articles.count)
- end
- test 'recursive trigger with auto responder' do
- group1 = Group.create!(
- name: 'Group dispatch',
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- group2 = Group.create!(
- name: 'Group with auto responder',
- active: true,
- email_address: EmailAddress.first,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create!(
- name: "002 - move ticket to #{group2.name}",
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.group_id' => {
- 'operator' => 'is',
- 'value' => group1.id.to_s,
- },
- 'ticket.organization_id' => {
- 'operator' => 'is',
- 'pre_condition' => 'specific',
- 'value' => User.lookup(email: 'nicole.braun@zammad.org').organization_id.to_s,
- }
- },
- perform: {
- 'ticket.group_id' => {
- 'value' => group2.id.to_s,
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- Trigger.create_or_update(
- name: "001 auto reply for tickets in group #{group1.name}",
- condition: {
- 'ticket.action' => {
- 'operator' => 'is',
- 'value' => 'create',
- },
- 'ticket.state_id' => {
- 'operator' => 'is',
- 'value' => Ticket::State.lookup(name: 'new').id.to_s,
- },
- 'ticket.group_id' => {
- 'operator' => 'is not',
- 'value' => group1.id.to_s,
- },
- },
- perform: {
- 'notification.email' => {
- 'body' => "some text<br>\#{ticket.customer.lastname}<br>\#{ticket.title}<br>\#{article.body}",
- 'recipient' => 'ticket_customer',
- 'subject' => "Thanks for your inquiry (\#{ticket.title})!",
- },
- 'ticket.priority_id' => {
- 'value' => Ticket::Priority.lookup(name: '3 high').id.to_s,
- },
- 'ticket.tags' => {
- 'operator' => 'add',
- 'value' => 'aa, kk',
- },
- },
- disable_notification: true,
- active: true,
- created_by_id: 1,
- updated_by_id: 1,
- )
- ticket1 = Ticket.create!(
- title: "some <b>title</b>\n äöüß",
- group: group1,
- customer: User.lookup(email: 'nicole.braun@zammad.org'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- Ticket::Article.create!(
- ticket_id: ticket1.id,
- from: 'some_sender@example.com',
- to: 'some_recipient@example.com',
- subject: 'some subject',
- message_id: 'some@id',
- body: "some message <b>note</b>\nnew line",
- internal: false,
- sender: Ticket::Article::Sender.find_by(name: 'Customer'),
- type: Ticket::Article::Type.find_by(name: 'web'),
- updated_by_id: 1,
- created_by_id: 1,
- )
- ticket1.reload
- assert_equal('some <b>title</b> äöüß', ticket1.title, 'ticket1.title verify')
- assert_equal('Group dispatch', ticket1.group.name, 'ticket1.group verify')
- assert_equal('new', ticket1.state.name, 'ticket1.state verify')
- assert_equal('2 normal', ticket1.priority.name, 'ticket1.priority verify')
- assert_equal(1, ticket1.articles.count, 'ticket1.articles verify')
- assert_equal([], ticket1.tag_list)
- TransactionDispatcher.commit
- ticket1.reload
- assert_equal('some <b>title</b> äöüß', ticket1.title, 'ticket1.title verify')
- assert_equal('Group with auto responder', ticket1.group.name, 'ticket1.group verify')
- assert_equal('new', ticket1.state.name, 'ticket1.state verify')
- assert_equal('3 high', ticket1.priority.name, 'ticket1.priority verify')
- assert_equal(2, ticket1.articles.count, 'ticket1.articles verify')
- assert_equal(%w[aa kk], ticket1.tag_list)
- email_raw = "From: nicole.braun@zammad.org
- To: zammad@example.com
- Subject: test 1
- X-Zammad-Ticket-Group: #{group1.name}
- test 1"
- ticket2, _article2, _user2 = Channel::EmailParser.new.process({ trusted: true }, email_raw)
- assert_equal('test 1', ticket2.title, 'ticket2.title verify')
- assert_equal('Group with auto responder', ticket2.group.name, 'ticket2.group verify')
- assert_equal('new', ticket2.state.name, 'ticket2.state verify')
- assert_equal('3 high', ticket2.priority.name, 'ticket2.priority verify')
- assert_equal(2, ticket2.articles.count, 'ticket2.articles verify')
- assert_equal(%w[aa kk], ticket2.tag_list)
- end
- end
|