Improved order of tests checks.

This commit is contained in:
Martin Edenhofer 2016-02-04 09:16:09 +01:00
parent a080d62611
commit f94c2e14b7

View file

@ -274,6 +274,22 @@ class ZendeskImportTest < ActiveSupport::TestCase
test 'check tickets' do
checks = [
{
id: 2,
data: {
title: 'test',
note: 'This is the first comment. Feel free to delete this sample ticket.',
create_article_type_id: 1,
create_article_sender_id: 2,
article_count: 2,
state_id: 3,
group_id: 3,
priority_id: 3,
owner_id: 1,
customer_id: 6,
organization_id: 2,
},
},
{
id: 3,
data: {
@ -290,22 +306,6 @@ class ZendeskImportTest < ActiveSupport::TestCase
organization_id: nil,
},
},
{
id: 143,
data: {
title: 'Basti ist cool',
note: 'Basti ist cool',
create_article_type_id: 8,
create_article_sender_id: 2,
article_count: 1,
state_id: 1,
group_id: 1,
priority_id: 2,
owner_id: 1,
customer_id: 143,
organization_id: nil,
},
},
{
id: 5,
data: {
@ -323,19 +323,19 @@ class ZendeskImportTest < ActiveSupport::TestCase
},
},
{
id: 2,
id: 143,
data: {
title: 'This is a sample ticket requested and submitted by you',
note: 'This is the first comment. Feel free to delete this sample ticket.',
create_article_type_id: 10,
create_article_sender_id: 1,
article_count: 4,
state_id: 3,
group_id: 3,
priority_id: 3,
title: 'Basti ist cool',
note: 'Basti ist cool',
create_article_type_id: 8,
create_article_sender_id: 2,
article_count: 1,
state_id: 1,
group_id: 1,
priority_id: 2,
owner_id: 1,
customer_id: 4,
organization_id: 2,
customer_id: 143,
organization_id: nil,
},
},
# {
@ -359,16 +359,16 @@ class ZendeskImportTest < ActiveSupport::TestCase
checks.each { |check|
ticket = Ticket.find( check[:id] )
assert_equal( check[:data][:title], ticket.title, 'title' )
assert_equal( check[:data][:create_article_type_id], ticket.create_article_type_id, 'created_article_type_id' )
assert_equal( check[:data][:create_article_sender_id], ticket.create_article_sender_id, 'created_article_sender_id' )
assert_equal( check[:data][:article_count], ticket.article_count, 'article_count' )
assert_equal( check[:data][:state_id], ticket.state.id, 'state_id' )
assert_equal( check[:data][:group_id], ticket.group.id, 'group_id' )
assert_equal( check[:data][:priority_id], ticket.priority.id, 'priority_id' )
assert_equal( check[:data][:owner_id], ticket.owner.id, 'owner_id' )
assert_equal( check[:data][:customer_id], ticket.customer.id, 'customer_id' )
assert_equal( check[:data][:organization_id], ticket.organization.try(:id), 'organization_id' )
assert_equal( check[:data][:title], ticket.title, "title of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:create_article_type_id], ticket.create_article_type_id, "created_article_type_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:create_article_sender_id], ticket.create_article_sender_id, "created_article_sender_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:article_count], ticket.article_count, "article_count of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:state_id], ticket.state.id, "state_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:group_id], ticket.group.id, "group_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:priority_id], ticket.priority.id, "priority_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:owner_id], ticket.owner.id, "owner_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:customer_id], ticket.customer.id, "customer_id of Ticket.find(#{check[:id]})" )
assert_equal( check[:data][:organization_id], ticket.organization.try(:id), "organization_id of Ticket.find(#{check[:id]})" )
}
end