Moved to init prepare/setup method for tests.
This commit is contained in:
parent
1e2f1da0aa
commit
3c523b4f7d
12 changed files with 793 additions and 725 deletions
|
@ -2,6 +2,10 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ActivityStreamTest < ActiveSupport::TestCase
|
class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
|
admin_user = nil
|
||||||
|
current_user = nil
|
||||||
|
activity_record_delay = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
role = Role.lookup(name: 'Admin')
|
role = Role.lookup(name: 'Admin')
|
||||||
group = Group.lookup(name: 'Users')
|
group = Group.lookup(name: 'Users')
|
||||||
admin_user = User.create_or_update(
|
admin_user = User.create_or_update(
|
||||||
|
@ -23,6 +27,7 @@ class ActivityStreamTest < ActiveSupport::TestCase
|
||||||
else
|
else
|
||||||
90.seconds
|
90.seconds
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
test 'ticket+user' do
|
test 'ticket+user' do
|
||||||
tests = [
|
tests = [
|
||||||
|
|
|
@ -155,8 +155,8 @@ class AutoWizardTest < ActiveSupport::TestCase
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
channel_id: 1,
|
channel_id: 1,
|
||||||
realname: 'some realname',
|
realname: 'Zammad',
|
||||||
email: 'helpdesk@example.com',
|
email: 'zammad@localhost',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ChatTest < ActiveSupport::TestCase
|
class ChatTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
agent2 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
groups = Group.all
|
groups = Group.all
|
||||||
|
@ -32,6 +35,7 @@ class ChatTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'default test' do
|
test 'default test' do
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,17 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class OnlineNotificationTest < ActiveSupport::TestCase
|
class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
|
group = nil
|
||||||
|
agent_user1 = nil
|
||||||
|
agent_user2 = nil
|
||||||
|
customer_user = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
role = Role.lookup(name: 'Agent')
|
role = Role.lookup(name: 'Agent')
|
||||||
group = Group.lookup(name: 'Users')
|
group = Group.create_or_update(
|
||||||
|
name: 'OnlineNotificationTest',
|
||||||
|
updated_by_id: 1,
|
||||||
|
created_by_id: 1
|
||||||
|
)
|
||||||
agent_user1 = User.create_or_update(
|
agent_user1 = User.create_or_update(
|
||||||
login: 'agent_online_notify1',
|
login: 'agent_online_notify1',
|
||||||
firstname: 'Bob',
|
firstname: 'Bob',
|
||||||
|
@ -29,6 +38,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
created_by_id: 1
|
created_by_id: 1
|
||||||
)
|
)
|
||||||
customer_user = User.lookup(email: 'nicole.braun@zammad.org')
|
customer_user = User.lookup(email: 'nicole.braun@zammad.org')
|
||||||
|
end
|
||||||
|
|
||||||
test 'ticket notification' do
|
test 'ticket notification' do
|
||||||
|
|
||||||
|
@ -36,7 +46,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# case #1
|
# case #1
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
group_id: Group.lookup(name: 'Users').id,
|
group: group,
|
||||||
customer_id: customer_user.id,
|
customer_id: customer_user.id,
|
||||||
owner_id: User.lookup(login: '-').id,
|
owner_id: User.lookup(login: '-').id,
|
||||||
title: 'Unit Test 1 (äöüß)!',
|
title: 'Unit Test 1 (äöüß)!',
|
||||||
|
@ -91,7 +101,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# case #2
|
# case #2
|
||||||
ticket2 = Ticket.create(
|
ticket2 = Ticket.create(
|
||||||
group_id: Group.lookup(name: 'Users').id,
|
group: group,
|
||||||
customer_id: customer_user.id,
|
customer_id: customer_user.id,
|
||||||
owner_id: agent_user1.id,
|
owner_id: agent_user1.id,
|
||||||
title: 'Unit Test 1 (äöüß)!',
|
title: 'Unit Test 1 (äöüß)!',
|
||||||
|
@ -146,7 +156,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# case #3
|
# case #3
|
||||||
ticket3 = Ticket.create(
|
ticket3 = Ticket.create(
|
||||||
group_id: Group.lookup(name: 'Users').id,
|
group: group,
|
||||||
customer_id: customer_user.id,
|
customer_id: customer_user.id,
|
||||||
owner_id: User.lookup(login: '-').id,
|
owner_id: User.lookup(login: '-').id,
|
||||||
title: 'Unit Test 2 (äöüß)!',
|
title: 'Unit Test 2 (äöüß)!',
|
||||||
|
@ -226,7 +236,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# case #4
|
# case #4
|
||||||
ticket4 = Ticket.create(
|
ticket4 = Ticket.create(
|
||||||
group_id: Group.lookup(name: 'Users').id,
|
group: group,
|
||||||
customer_id: customer_user.id,
|
customer_id: customer_user.id,
|
||||||
owner_id: agent_user1.id,
|
owner_id: agent_user1.id,
|
||||||
title: 'Unit Test 3 (äöüß)!',
|
title: 'Unit Test 3 (äöüß)!',
|
||||||
|
@ -280,7 +290,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# case #5
|
# case #5
|
||||||
ticket5 = Ticket.create(
|
ticket5 = Ticket.create(
|
||||||
group_id: Group.lookup(name: 'Users').id,
|
group: group,
|
||||||
customer_id: customer_user.id,
|
customer_id: customer_user.id,
|
||||||
owner_id: User.lookup(login: '-').id,
|
owner_id: User.lookup(login: '-').id,
|
||||||
title: 'Unit Test 4 (äöüß)!',
|
title: 'Unit Test 4 (äöüß)!',
|
||||||
|
@ -364,7 +374,7 @@ class OnlineNotificationTest < ActiveSupport::TestCase
|
||||||
test 'ticket notification item check' do
|
test 'ticket notification item check' do
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some title',
|
title: 'some title',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: group,
|
||||||
customer_id: customer_user.id,
|
customer_id: customer_user.id,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
|
|
@ -2,10 +2,15 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
|
class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
organization1 = nil
|
||||||
|
customer1 = nil
|
||||||
|
customer2 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
groups = Group.where( name: 'Users' )
|
groups = Group.where(name: 'Users')
|
||||||
roles = Role.where( name: 'Agent' )
|
roles = Role.where(name: 'Agent')
|
||||||
agent1 = User.create_or_update(
|
agent1 = User.create_or_update(
|
||||||
login: 'organization-ref-object-update-agent1@example.com',
|
login: 'organization-ref-object-update-agent1@example.com',
|
||||||
firstname: 'Notification',
|
firstname: 'Notification',
|
||||||
|
@ -19,7 +24,7 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
roles = Role.where( name: 'Customer' )
|
roles = Role.where(name: 'Customer')
|
||||||
organization1 = Organization.create_if_not_exists(
|
organization1 = Organization.create_if_not_exists(
|
||||||
name: 'Ref Object Update Org 1',
|
name: 'Ref Object Update Org 1',
|
||||||
updated_at: '2015-02-05 16:37:00',
|
updated_at: '2015-02-05 16:37:00',
|
||||||
|
@ -58,22 +63,23 @@ class OrganizationRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'a - check if ticket and customer has been updated' do
|
test 'b - check if ticket and customer has been updated' do
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
title: "some title1\n äöüß",
|
title: "some title1\n äöüß",
|
||||||
group: Group.lookup( name: 'Users'),
|
group: Group.lookup(name: 'Users'),
|
||||||
customer_id: customer1.id,
|
customer_id: customer1.id,
|
||||||
owner_id: agent1.id,
|
owner_id: agent1.id,
|
||||||
state: Ticket::State.lookup( name: 'new' ),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup( name: '2 normal' ),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
assert(ticket, 'ticket created')
|
assert(ticket, 'ticket created')
|
||||||
assert_equal(ticket.customer.id, customer1.id )
|
assert_equal(ticket.customer.id, customer1.id)
|
||||||
assert_equal(ticket.organization.id, organization1.id )
|
assert_equal(ticket.organization.id, organization1.id)
|
||||||
|
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class SessionBasicTest < ActiveSupport::TestCase
|
class SessionBasicTest < ActiveSupport::TestCase
|
||||||
|
test 'aaa - setup' do
|
||||||
user = User.lookup(id: 1)
|
user = User.lookup(id: 1)
|
||||||
roles = Role.where(name: %w(Agent Admin))
|
roles = Role.where(name: %w(Agent Admin))
|
||||||
user.roles = roles
|
user.roles = roles
|
||||||
user.save
|
user.save
|
||||||
|
end
|
||||||
|
|
||||||
test 'a cache' do
|
test 'b cache' do
|
||||||
Sessions::CacheIn.set('last_run_test', true, { expires_in: 1.second })
|
Sessions::CacheIn.set('last_run_test', true, { expires_in: 1.second })
|
||||||
result = Sessions::CacheIn.get('last_run_test')
|
result = Sessions::CacheIn.get('last_run_test')
|
||||||
assert_equal(true, result, 'check 1')
|
assert_equal(true, result, 'check 1')
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
|
class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
organization1 = nil
|
||||||
|
customer1 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
groups = Group.where( name: 'Users' )
|
groups = Group.where(name: 'Users')
|
||||||
roles = Role.where( name: 'Agent' )
|
roles = Role.where(name: 'Agent')
|
||||||
agent1 = User.create_or_update(
|
agent1 = User.create_or_update(
|
||||||
login: 'ticket-customer-organization-update-agent1@example.com',
|
login: 'ticket-customer-organization-update-agent1@example.com',
|
||||||
firstname: 'Notification',
|
firstname: 'Notification',
|
||||||
|
@ -19,7 +23,7 @@ class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
roles = Role.where( name: 'Customer' )
|
roles = Role.where(name: 'Customer')
|
||||||
organization1 = Organization.create_if_not_exists(
|
organization1 = Organization.create_if_not_exists(
|
||||||
name: 'Customer Organization Update',
|
name: 'Customer Organization Update',
|
||||||
updated_at: '2015-02-05 16:37:00',
|
updated_at: '2015-02-05 16:37:00',
|
||||||
|
@ -39,22 +43,23 @@ class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'create ticket, update customers organization later' do
|
test 'create ticket, update customers organization later' do
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
title: "some title1\n äöüß",
|
title: "some title1\n äöüß",
|
||||||
group: Group.lookup( name: 'Users'),
|
group: Group.lookup(name: 'Users'),
|
||||||
customer_id: customer1.id,
|
customer_id: customer1.id,
|
||||||
owner_id: agent1.id,
|
owner_id: agent1.id,
|
||||||
state: Ticket::State.lookup( name: 'new' ),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup( name: '2 normal' ),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
assert( ticket, 'ticket created' )
|
assert(ticket, 'ticket created')
|
||||||
assert_equal( customer1.id, ticket.customer.id )
|
assert_equal(customer1.id, ticket.customer.id)
|
||||||
assert_equal( organization1.id, ticket.organization.id )
|
assert_equal(organization1.id, ticket.organization.id)
|
||||||
|
|
||||||
# update customer organization
|
# update customer organization
|
||||||
customer1.organization_id = nil
|
customer1.organization_id = nil
|
||||||
|
@ -62,7 +67,7 @@ class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# verify ticket
|
# verify ticket
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
assert_equal( nil, ticket.organization_id )
|
assert_equal(nil, ticket.organization_id)
|
||||||
|
|
||||||
# update customer organization
|
# update customer organization
|
||||||
customer1.organization_id = organization1.id
|
customer1.organization_id = organization1.id
|
||||||
|
@ -70,7 +75,7 @@ class TicketCustomerOrganizationUpdateTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# verify ticket
|
# verify ticket
|
||||||
ticket = Ticket.find(ticket.id)
|
ticket = Ticket.find(ticket.id)
|
||||||
assert_equal( organization1.id, ticket.organization_id )
|
assert_equal(organization1.id, ticket.organization_id)
|
||||||
|
|
||||||
ticket.destroy
|
ticket.destroy
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class TicketNotificationTest < ActiveSupport::TestCase
|
class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
agent2 = nil
|
||||||
|
customer = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
Trigger.create_or_update(
|
Trigger.create_or_update(
|
||||||
name: 'auto reply - new ticket',
|
name: 'auto reply - new ticket',
|
||||||
condition: {
|
condition: {
|
||||||
|
@ -43,7 +46,12 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
# create agent1 & agent2
|
# create agent1 & agent2
|
||||||
groups = Group.where(name: 'Users')
|
Group.create_or_update(
|
||||||
|
name: 'TicketNotificationTest',
|
||||||
|
updated_by_id: 1,
|
||||||
|
created_by_id: 1
|
||||||
|
)
|
||||||
|
groups = Group.where(name: 'TicketNotificationTest')
|
||||||
roles = Role.where(name: 'Agent')
|
roles = Role.where(name: 'Agent')
|
||||||
agent1 = User.create_or_update(
|
agent1 = User.create_or_update(
|
||||||
login: 'ticket-notification-agent1@example.com',
|
login: 'ticket-notification-agent1@example.com',
|
||||||
|
@ -96,13 +104,14 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'ticket notification - to all agents / to explicit agents' do
|
test 'ticket notification - to all agents / to explicit agents' do
|
||||||
|
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification test 1',
|
title: 'some notification test 1',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -135,8 +144,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification test 1',
|
title: 'some notification test 2',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -172,8 +181,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification test 1',
|
title: 'some notification test 3',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -264,8 +273,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# create ticket with agent1 as owner
|
# create ticket with agent1 as owner
|
||||||
ticket2 = Ticket.create(
|
ticket2 = Ticket.create(
|
||||||
title: 'some notification test 2',
|
title: 'some notification test 4',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer_id: 2,
|
customer_id: 2,
|
||||||
owner_id: agent1.id,
|
owner_id: agent1.id,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
|
@ -326,8 +335,8 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
# create ticket with agent2 and agent1 as owner
|
# create ticket with agent2 and agent1 as owner
|
||||||
ticket3 = Ticket.create(
|
ticket3 = Ticket.create(
|
||||||
title: 'some notification test 3',
|
title: 'some notification test 5',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer_id: 2,
|
customer_id: 2,
|
||||||
owner_id: agent1.id,
|
owner_id: agent1.id,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
|
@ -414,7 +423,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification test 1 - no notification',
|
title: 'some notification test 1 - no notification',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -467,7 +476,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 1',
|
title: 'some notification test - z preferences tests 1',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -513,7 +522,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket2 = Ticket.create(
|
ticket2 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 2',
|
title: 'some notification test - z preferences tests 2',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
owner: agent1,
|
owner: agent1,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
|
@ -559,7 +568,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket3 = Ticket.create(
|
ticket3 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 3',
|
title: 'some notification test - z preferences tests 3',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
owner: agent2,
|
owner: agent2,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
|
@ -608,7 +617,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_me'] = true
|
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_me'] = true
|
||||||
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_nobody'] = false
|
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_nobody'] = false
|
||||||
agent1.preferences['notification_config']['matrix']['update']['criteria']['no'] = true
|
agent1.preferences['notification_config']['matrix']['update']['criteria']['no'] = true
|
||||||
agent1.preferences['notification_config']['group_ids'] = [Group.lookup(name: 'Users').id.to_s]
|
agent1.preferences['notification_config']['group_ids'] = [Group.lookup(name: 'TicketNotificationTest').id.to_s]
|
||||||
agent1.save
|
agent1.save
|
||||||
|
|
||||||
agent2.preferences['notification_config']['matrix']['create']['criteria']['owned_by_me'] = false
|
agent2.preferences['notification_config']['matrix']['create']['criteria']['owned_by_me'] = false
|
||||||
|
@ -623,7 +632,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket4 = Ticket.create(
|
ticket4 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 4',
|
title: 'some notification test - z preferences tests 4',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -672,7 +681,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_me'] = true
|
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_me'] = true
|
||||||
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_nobody'] = false
|
agent1.preferences['notification_config']['matrix']['update']['criteria']['owned_by_nobody'] = false
|
||||||
agent1.preferences['notification_config']['matrix']['update']['criteria']['no'] = true
|
agent1.preferences['notification_config']['matrix']['update']['criteria']['no'] = true
|
||||||
agent1.preferences['notification_config']['group_ids'] = [Group.lookup(name: 'Users').id.to_s]
|
agent1.preferences['notification_config']['group_ids'] = [Group.lookup(name: 'TicketNotificationTest').id.to_s]
|
||||||
agent1.save
|
agent1.save
|
||||||
|
|
||||||
agent2.preferences['notification_config']['matrix']['create']['criteria']['owned_by_me'] = false
|
agent2.preferences['notification_config']['matrix']['create']['criteria']['owned_by_me'] = false
|
||||||
|
@ -687,7 +696,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket5 = Ticket.create(
|
ticket5 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 5',
|
title: 'some notification test - z preferences tests 5',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -751,7 +760,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket6 = Ticket.create(
|
ticket6 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 6',
|
title: 'some notification test - z preferences tests 6',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
owner: agent1,
|
owner: agent1,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
|
@ -828,7 +837,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket7 = Ticket.create(
|
ticket7 = Ticket.create(
|
||||||
title: 'some notification test - z preferences tests 7',
|
title: 'some notification test - z preferences tests 7',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
owner: agent1,
|
owner: agent1,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
|
@ -883,7 +892,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification event test 1',
|
title: 'some notification event test 1',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
@ -943,7 +952,7 @@ class TicketNotificationTest < ActiveSupport::TestCase
|
||||||
# create ticket in group
|
# create ticket in group
|
||||||
ticket1 = Ticket.create(
|
ticket1 = Ticket.create(
|
||||||
title: 'some notification template test 1 Bobs\'s resumé',
|
title: 'some notification template test 1 Bobs\'s resumé',
|
||||||
group: Group.lookup(name: 'Users'),
|
group: Group.lookup(name: 'TicketNotificationTest'),
|
||||||
customer: customer,
|
customer: customer,
|
||||||
state: Ticket::State.lookup(name: 'new'),
|
state: Ticket::State.lookup(name: 'new'),
|
||||||
priority: Ticket::Priority.lookup(name: '2 normal'),
|
priority: Ticket::Priority.lookup(name: '2 normal'),
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class TicketOverviewTest < ActiveSupport::TestCase
|
class TicketOverviewTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
agent2 = nil
|
||||||
|
organization_id = nil
|
||||||
|
customer1 = nil
|
||||||
|
customer2 = nil
|
||||||
|
customer3 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
group = Group.create_or_update(
|
group = Group.create_or_update(
|
||||||
|
@ -273,6 +280,7 @@ class TicketOverviewTest < ActiveSupport::TestCase
|
||||||
view_mode_default: 's',
|
view_mode_default: 's',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'ticket create' do
|
test 'ticket create' do
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,15 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
organization1 = nil
|
||||||
|
customer1 = nil
|
||||||
|
customer2 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
groups = Group.where( name: 'Users' )
|
groups = Group.where(name: 'Users')
|
||||||
roles = Role.where( name: 'Agent' )
|
roles = Role.where(name: 'Agent')
|
||||||
agent1 = User.create_or_update(
|
agent1 = User.create_or_update(
|
||||||
login: 'ticket-ref-object-update-agent1@example.com',
|
login: 'ticket-ref-object-update-agent1@example.com',
|
||||||
firstname: 'Notification',
|
firstname: 'Notification',
|
||||||
|
@ -19,7 +24,7 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
roles = Role.where( name: 'Customer' )
|
roles = Role.where(name: 'Customer')
|
||||||
organization1 = Organization.create_if_not_exists(
|
organization1 = Organization.create_if_not_exists(
|
||||||
name: 'Ref Object Update Org',
|
name: 'Ref Object Update Org',
|
||||||
updated_at: '2015-02-05 16:37:00',
|
updated_at: '2015-02-05 16:37:00',
|
||||||
|
@ -52,8 +57,9 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'a - check if customer and organization has been updated' do
|
test 'b - check if customer and organization has been updated' do
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
title: "some title1\n äöüß",
|
title: "some title1\n äöüß",
|
||||||
|
@ -66,8 +72,8 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
assert(ticket, 'ticket created')
|
assert(ticket, 'ticket created')
|
||||||
assert_equal(ticket.customer.id, customer1.id )
|
assert_equal(ticket.customer.id, customer1.id)
|
||||||
assert_equal(ticket.organization.id, organization1.id )
|
assert_equal(ticket.organization.id, organization1.id)
|
||||||
|
|
||||||
# check if customer and organization has been touched
|
# check if customer and organization has been touched
|
||||||
customer1 = User.find(customer1.id)
|
customer1 = User.find(customer1.id)
|
||||||
|
@ -105,7 +111,7 @@ class TicketRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'b - check if customer (not organization) has been updated' do
|
test 'c - check if customer (not organization) has been updated' do
|
||||||
|
|
||||||
sleep 6
|
sleep 6
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class TicketSelectorTest < ActiveSupport::TestCase
|
class TicketSelectorTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
agent2 = nil
|
||||||
|
group = nil
|
||||||
|
organization1 = nil
|
||||||
|
customer1 = nil
|
||||||
|
customer2 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
group = Group.create_or_update(
|
group = Group.create_or_update(
|
||||||
|
@ -72,6 +79,7 @@ class TicketSelectorTest < ActiveSupport::TestCase
|
||||||
)
|
)
|
||||||
|
|
||||||
Ticket.where(group_id: group.id).destroy_all
|
Ticket.where(group_id: group.id).destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
test 'ticket create' do
|
test 'ticket create' do
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class UserRefObjectTouchTest < ActiveSupport::TestCase
|
class UserRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
|
agent1 = nil
|
||||||
|
organization1 = nil
|
||||||
|
customer1 = nil
|
||||||
|
customer2 = nil
|
||||||
|
test 'aaa - setup' do
|
||||||
|
|
||||||
# create base
|
# create base
|
||||||
groups = Group.where(name: 'Users')
|
groups = Group.where(name: 'Users')
|
||||||
|
@ -52,8 +57,9 @@ class UserRefObjectTouchTest < ActiveSupport::TestCase
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test 'a - check if ticket and organization has been updated' do
|
test 'b - check if ticket and organization has been updated' do
|
||||||
|
|
||||||
ticket = Ticket.create(
|
ticket = Ticket.create(
|
||||||
title: "some title1\n äöüß",
|
title: "some title1\n äöüß",
|
||||||
|
|
Loading…
Reference in a new issue