Added support for zendesk custom fields.

This commit is contained in:
Martin Edenhofer 2016-05-19 15:01:02 +02:00
parent 97911a4122
commit 5aa51f82a6
3 changed files with 187 additions and 125 deletions

View file

@ -383,8 +383,10 @@ returns
end end
data_type = nil data_type = nil
if attribute.data_type =~ /^input|select|richtext|textarea$/ if attribute.data_type =~ /^input|select|richtext|textarea|checkbox$/
data_type = :string data_type = :string
elsif attribute.data_type =~ /^integer$/
data_type = :integer
elsif attribute.data_type =~ /^boolean|active$/ elsif attribute.data_type =~ /^boolean|active$/
data_type = :boolean data_type = :boolean
elsif attribute.data_type =~ /^datetime$/ elsif attribute.data_type =~ /^datetime$/
@ -395,7 +397,7 @@ returns
# change field # change field
if model.column_names.include?(attribute.name) if model.column_names.include?(attribute.name)
if attribute.data_type =~ /^input|select|richtext|textarea$/ if attribute.data_type =~ /^input|select|richtext|textarea|checkbox$/
ActiveRecord::Migration.change_column( ActiveRecord::Migration.change_column(
model.table_name, model.table_name,
attribute.name, attribute.name,
@ -403,7 +405,7 @@ returns
limit: attribute.data_option[:maxlength], limit: attribute.data_option[:maxlength],
null: true null: true
) )
elsif attribute.data_type =~ /^boolean|active|datetime|date$/ elsif attribute.data_type =~ /^integer|datetime|date$/
ActiveRecord::Migration.change_column( ActiveRecord::Migration.change_column(
model.table_name, model.table_name,
attribute.name, attribute.name,
@ -411,6 +413,14 @@ returns
default: attribute.data_option[:default], default: attribute.data_option[:default],
null: true null: true
) )
elsif attribute.data_type =~ /^boolean|active$/
ActiveRecord::Migration.change_column(
model.table_name,
attribute.name,
data_type,
default: attribute.data_option[:default],
null: false
)
else else
raise "Unknown attribute.data_type '#{attribute.data_type}', can't update attribute" raise "Unknown attribute.data_type '#{attribute.data_type}', can't update attribute"
end end
@ -424,7 +434,7 @@ returns
end end
# create field # create field
if attribute.data_type =~ /^input|select|richtext|textarea$/ if attribute.data_type =~ /^input|select|richtext|textarea|checkbox$/
ActiveRecord::Migration.add_column( ActiveRecord::Migration.add_column(
model.table_name, model.table_name,
attribute.name, attribute.name,
@ -432,6 +442,14 @@ returns
limit: attribute.data_option[:maxlength], limit: attribute.data_option[:maxlength],
null: true null: true
) )
elsif attribute.data_type =~ /^integer$/
ActiveRecord::Migration.add_column(
model.table_name,
attribute.name,
data_type,
default: attribute.data_option[:default],
null: true
)
elsif attribute.data_type =~ /^boolean|active$/ elsif attribute.data_type =~ /^boolean|active$/
ActiveRecord::Migration.add_column( ActiveRecord::Migration.add_column(
model.table_name, model.table_name,
@ -471,7 +489,7 @@ returns
def check_name def check_name
if name if name
return true if name !~ /_(id|ids)$/i && name !~ /^id$/i return true if name !~ /_(id|ids)$/i && name !~ /^id$/i && name !~ /\s/
end end
raise "Name can't get used, *_id and *_ids are not allowed" raise "Name can't get used, *_id and *_ids are not allowed"
end end

View file

@ -182,21 +182,21 @@ module Import::Zendesk
return return
{ {
:Group => { Group: {
:total => 1234, total: 1234,
:done => 13, done: 13,
}, },
:Organization => { Organization: {
:total => 1234, total: 1234,
:done => 13, done: 13,
}, },
:User => { User: {
:total => 1234, total: 1234,
:done => 13, done: 13,
}, },
:Ticket => { Ticket: {
:total => 1234, total: 1234,
:done => 13, done: 13,
}, },
} }
@ -206,7 +206,6 @@ module Import::Zendesk
data = statistic data = statistic
# TODO: Ticket, User, Organization fields
{ {
Group: { Group: {
done: Group.count, done: Group.count,
@ -334,8 +333,8 @@ module Import::Zendesk
zendesk_field['key'] # TODO: y?! zendesk_field['key'] # TODO: y?!
end end
@zendesk_ticket_field_mapping ||= {} @zendesk_field_mapping ||= {}
@zendesk_ticket_field_mapping[ zendesk_field.id ] = name @zendesk_field_mapping[ zendesk_field.id ] = name
data_type = zendesk_field.type data_type = zendesk_field.type
data_option = { data_option = {
@ -348,6 +347,16 @@ module Import::Zendesk
data_option = { data_option = {
future: true, future: true,
past: true, past: true,
diff: 0,
}.merge( data_option )
elsif zendesk_field.type == 'checkbox'
data_type = 'checkbox'
data_option = {
type: zendesk_field.type,
default: '',
options: {},
}.merge( data_option ) }.merge( data_option )
elsif zendesk_field.type == 'regexp' elsif zendesk_field.type == 'regexp'
@ -355,14 +364,32 @@ module Import::Zendesk
data_type = 'input' data_type = 'input'
data_option = { data_option = {
type: 'text', type: 'text',
maxlength: 255,
regex: zendesk_field.regexp_for_validation, regex: zendesk_field.regexp_for_validation,
}.merge( data_option ) }.merge( data_option )
elsif zendesk_field.type == 'decimal'
data_type = 'input'
data_option = {
type: 'text',
maxlength: 255,
}.merge( data_option )
elsif zendesk_field.type == 'integer'
data_type = 'integer'
data_option = {
min: 0,
max: 999_999_999,
}.merge( data_option )
elsif zendesk_field.type == 'text' elsif zendesk_field.type == 'text'
data_type = 'input' data_type = 'input'
data_option = { data_option = {
type: zendesk_field.type, type: zendesk_field.type,
maxlength: 255,
}.merge( data_option ) }.merge( data_option )
elsif zendesk_field.type == 'textarea' elsif zendesk_field.type == 'textarea'
@ -370,9 +397,10 @@ module Import::Zendesk
data_type = 'input' data_type = 'input'
data_option = { data_option = {
type: zendesk_field.type, type: zendesk_field.type,
maxlength: 255,
}.merge( data_option ) }.merge( data_option )
elsif zendesk_field.type == 'tagger' elsif zendesk_field.type == 'tagger' || zendesk_field.type == 'dropdown'
# \"custom_field_options\"=>[{\"id\"=>28353445 # \"custom_field_options\"=>[{\"id\"=>28353445
# \"name\"=>\"Another Value\" # \"name\"=>\"Another Value\"
@ -386,7 +414,6 @@ module Import::Zendesk
# \"name\"=>\"Value 2\" # \"name\"=>\"Value 2\"
# \"raw_name\"=>\"Value 2\" # \"raw_name\"=>\"Value 2\"
# \"value\"=>\"key2\"}]}> # \"value\"=>\"key2\"}]}>
# " # "
options = {} options = {}
@ -403,6 +430,7 @@ module Import::Zendesk
data_type = 'select' data_type = 'select'
data_option = { data_option = {
default: '',
options: options, options: options,
}.merge( data_option ) }.merge( data_option )
end end
@ -425,6 +453,7 @@ module Import::Zendesk
}.merge(screens) }.merge(screens)
} }
end end
name.gsub!(/\s/, '_')
ObjectManager::Attribute.add( ObjectManager::Attribute.add(
object: local_object, object: local_object,
@ -435,11 +464,11 @@ module Import::Zendesk
editable: !zendesk_field.removable, editable: !zendesk_field.removable,
active: zendesk_field.active, active: zendesk_field.active,
screens: screens, screens: screens,
pending_migration: false,
position: zendesk_field.position, position: zendesk_field.position,
created_by_id: 1, created_by_id: 1,
updated_by_id: 1, updated_by_id: 1,
) )
ObjectManager::Attribute.migration_execute
end end
# OAuth # OAuth
@ -481,6 +510,7 @@ module Import::Zendesk
@zendesk_organization_mapping = {} @zendesk_organization_mapping = {}
@client.organizations.each { |zendesk_organization| @client.organizations.each { |zendesk_organization|
custom_fields = get_fields(zendesk_organization.organization_fields)
local_organization_fields = { local_organization_fields = {
name: zendesk_organization.name, name: zendesk_organization.name,
@ -490,10 +520,9 @@ module Import::Zendesk
# }.merge(zendesk_organization.organization_fields) # TODO # }.merge(zendesk_organization.organization_fields) # TODO
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1 created_by_id: 1
} }.merge(custom_fields)
local_organization = Organization.create_if_not_exists( local_organization_fields )
local_organization = Organization.create_if_not_exists(local_organization_fields)
@zendesk_organization_mapping[ zendesk_organization.id ] = local_organization.id @zendesk_organization_mapping[ zendesk_organization.id ] = local_organization.id
} }
end end
@ -511,7 +540,7 @@ module Import::Zendesk
role_customer = Role.lookup(name: 'Customer') role_customer = Role.lookup(name: 'Customer')
@client.users.all! { |zendesk_user| @client.users.all! { |zendesk_user|
custom_fields = get_fields(zendesk_user.user_fields)
local_user_fields = { local_user_fields = {
login: zendesk_user.id.to_s, # Zendesk users may have no other identifier than the ID, e.g. twitter users login: zendesk_user.id.to_s, # Zendesk users may have no other identifier than the ID, e.g. twitter users
firstname: zendesk_user.name, firstname: zendesk_user.name,
@ -527,7 +556,7 @@ module Import::Zendesk
last_login: zendesk_user.last_login_at, last_login: zendesk_user.last_login_at,
updated_by_id: 1, updated_by_id: 1,
created_by_id: 1 created_by_id: 1
} }.merge(custom_fields)
if @zendesk_user_group_mapping[ zendesk_user.id ] if @zendesk_user_group_mapping[ zendesk_user.id ]
@ -616,19 +645,7 @@ module Import::Zendesk
article_type_facebook_feed_comment = Ticket::Article::Type.lookup(name: 'facebook feed comment') article_type_facebook_feed_comment = Ticket::Article::Type.lookup(name: 'facebook feed comment')
@client.tickets.all! { |zendesk_ticket| @client.tickets.all! { |zendesk_ticket|
custom_fields = get_custom_fields(zendesk_ticket.custom_fields)
zendesk_ticket_fields = {}
zendesk_ticket.custom_fields.each { |zendesk_ticket_field|
field_name = @zendesk_ticket_field_mapping[ zendesk_ticket_field['id'] ]
field_value = zendesk_ticket_field['value']
if @zendesk_ticket_field_value_mapping[ field_name ]
field_value = @zendesk_ticket_field_value_mapping[ field_name ][ field_value ]
end
zendesk_ticket_fields[ field_name ] = field_value
}
local_ticket_fields = { local_ticket_fields = {
id: zendesk_ticket.id, id: zendesk_ticket.id,
title: zendesk_ticket.subject, title: zendesk_ticket.subject,
@ -643,8 +660,7 @@ module Import::Zendesk
created_at: zendesk_ticket.created_at, created_at: zendesk_ticket.created_at,
updated_by_id: @zendesk_user_mapping[ zendesk_ticket.requester_id ] || 1, updated_by_id: @zendesk_user_mapping[ zendesk_ticket.requester_id ] || 1,
created_by_id: @zendesk_user_mapping[ zendesk_ticket.requester_id ] || 1, created_by_id: @zendesk_user_mapping[ zendesk_ticket.requester_id ] || 1,
# }.merge(zendesk_ticket_fields) TODO }.merge(custom_fields)
}
ticket_author = User.find( @zendesk_user_mapping[ zendesk_ticket.requester_id ] || 1 ) ticket_author = User.find( @zendesk_user_mapping[ zendesk_ticket.requester_id ] || 1 )
local_ticket_fields[:create_article_sender_id] = if ticket_author.role?('Customer') local_ticket_fields[:create_article_sender_id] = if ticket_author.role?('Customer')
@ -1042,4 +1058,27 @@ module Import::Zendesk
ActiveRecord::Base.connection.reset_pk_sequence!(table) ActiveRecord::Base.connection.reset_pk_sequence!(table)
end end
def get_custom_fields(custom_fields)
return {} if !custom_fields
fields = {}
custom_fields.each { |custom_field|
field_name = @zendesk_field_mapping[ custom_field['id'] ].gsub(/\s/, '_')
field_value = custom_field['value']
if @zendesk_ticket_field_value_mapping[ field_name ]
field_value = @zendesk_ticket_field_value_mapping[ field_name ][ field_value ]
end
fields[ field_name ] = field_value
}
fields
end
def get_fields(user_fields)
return {} if !user_fields
fields = {}
user_fields.each {|key, value|
fields[key] = value
}
fields
end
end end

View file

@ -28,8 +28,8 @@ class ZendeskImportTest < ActiveSupport::TestCase
compare_statistic = { compare_statistic = {
'Tickets' => 143, 'Tickets' => 143,
'TicketFields' => 13, 'TicketFields' => 13,
'UserFields' => 1, 'UserFields' => 2,
'OrganizationFields' => 1, 'OrganizationFields' => 2,
'Groups' => 2, 'Groups' => 2,
'Organizations' => 1, 'Organizations' => 1,
'Users' => 141, 'Users' => 141,
@ -39,18 +39,18 @@ class ZendeskImportTest < ActiveSupport::TestCase
'Automations' => 5 'Automations' => 5
} }
assert_equal( compare_statistic, remote_statistic, 'statistic' ) assert_equal(compare_statistic, remote_statistic, 'statistic')
end end
# check count of imported items # check count of imported items
test 'check counts' do test 'check counts' do
assert_equal( 143, User.count, 'users' ) assert_equal(143, User.count, 'users')
assert_equal( 3, Group.count, 'groups' ) assert_equal(3, Group.count, 'groups')
assert_equal( 6, Role.count, 'roles' ) assert_equal(6, Role.count, 'roles')
assert_equal( 2, Organization.count, 'organizations' ) assert_equal(2, Organization.count, 'organizations')
assert_equal( 143, Ticket.count, 'tickets' ) assert_equal(143, Ticket.count, 'tickets')
assert_equal( 151, Ticket::Article.count, 'ticket articles' ) assert_equal(151, Ticket::Article.count, 'ticket articles')
assert_equal( 2, Store.count, 'ticket article attachments' ) assert_equal(2, Store.count, 'ticket article attachments')
# TODO: Macros, Views, Automations... # TODO: Macros, Views, Automations...
end end
@ -58,13 +58,13 @@ class ZendeskImportTest < ActiveSupport::TestCase
# check imported users and permission # check imported users and permission
test 'check users' do test 'check users' do
role_admin = Role.find_by( name: 'Admin' ) role_admin = Role.find_by(name: 'Admin')
role_agent = Role.find_by( name: 'Agent' ) role_agent = Role.find_by(name: 'Agent')
role_customer = Role.find_by( name: 'Customer' ) role_customer = Role.find_by(name: 'Customer')
group_users = Group.find_by( name: 'Users' ) group_users = Group.find_by(name: 'Users')
group_support = Group.find_by( name: 'Support' ) group_support = Group.find_by(name: 'Support')
group_additional_group = Group.find_by( name: 'Additional Group' ) group_additional_group = Group.find_by(name: 'Additional Group')
checks = [ checks = [
{ {
@ -76,6 +76,7 @@ class ZendeskImportTest < ActiveSupport::TestCase
email: 'bob.smith@znuny.com', email: 'bob.smith@znuny.com',
active: true, active: true,
phone: '00114124', phone: '00114124',
lieblingstier: 'Hundä',
}, },
roles: [role_agent, role_admin], roles: [role_agent, role_admin],
groups: [group_support], groups: [group_support],
@ -88,6 +89,7 @@ class ZendeskImportTest < ActiveSupport::TestCase
login: '1202726471', login: '1202726471',
email: 'hansimerkur@znuny.com', email: 'hansimerkur@znuny.com',
active: true, active: true,
lieblingstier: nil,
}, },
roles: [role_agent, role_admin], roles: [role_agent, role_admin],
groups: [group_additional_group, group_support], groups: [group_additional_group, group_support],
@ -131,26 +133,18 @@ class ZendeskImportTest < ActiveSupport::TestCase
] ]
checks.each { |check| checks.each { |check|
user = User.find( check[:id] ) user = User.find(check[:id])
check[:data].each {|key, value|
assert_equal( check[:data][:firstname], user.firstname, 'firstname' ) assert_equal(value, user[key], "user.#{key} for user_id #{check[:id]}")
assert_equal( check[:data][:lastname], user.lastname, 'lastname' ) }
assert_equal( check[:data][:login], user.login, 'login' ) assert_equal(check[:roles], user.roles.to_a, "#{user.login} roles")
assert_equal( check[:data][:email], user.email, 'email' ) assert_equal(check[:groups], user.groups.to_a, "#{user.login} groups")
assert_equal( check[:data][:phone], user.phone, 'phone' )
assert_equal( check[:data][:active], user.active, 'active' )
assert_equal( check[:roles], user.roles.to_a, "#{user.login} roles" )
assert_equal( check[:groups], user.groups.to_a, "#{user.login} groups" )
} }
end end
# check user fields # check user fields
test 'check user fields' do test 'check user fields' do
local_fields = User.column_names local_fields = User.column_names
# TODO
copmare_fields = %w( copmare_fields = %w(
id id
organization_id organization_id
@ -182,9 +176,11 @@ class ZendeskImportTest < ActiveSupport::TestCase
updated_by_id updated_by_id
created_by_id created_by_id
created_at created_at
updated_at) updated_at
lieblingstier
custom_dropdown)
assert_equal( copmare_fields, local_fields, 'user fields' ) assert_equal(copmare_fields, local_fields, 'user fields')
end end
# check groups/queues # check groups/queues
@ -215,10 +211,10 @@ class ZendeskImportTest < ActiveSupport::TestCase
] ]
checks.each { |check| checks.each { |check|
group = Group.find( check[:id] ) group = Group.find(check[:id])
check[:data].each {|key, value|
assert_equal( check[:data][:name], group.name, 'name' ) assert_equal(value, group[key], "group.#{key} for group_id #{check[:id]}")
assert_equal( check[:data][:active], group.active, 'active' ) }
} }
end end
@ -231,6 +227,8 @@ class ZendeskImportTest < ActiveSupport::TestCase
data: { data: {
name: 'Zammad Foundation', name: 'Zammad Foundation',
note: '', note: '',
api_key: nil,
custom_dropdown: nil,
}, },
}, },
{ {
@ -238,24 +236,23 @@ class ZendeskImportTest < ActiveSupport::TestCase
data: { data: {
name: 'Znuny', name: 'Znuny',
note: nil, note: nil,
api_key: 'my api öäüß',
custom_dropdown: 'b',
}, },
}, },
] ]
checks.each { |check| checks.each { |check|
organization = Organization.find( check[:id] ) organization = Organization.find(check[:id])
check[:data].each {|key, value|
assert_equal( check[:data][:name], organization.name, 'name' ) assert_equal(value, organization[key], "organization.#{key} for organization_id #{check[:id]}")
assert_equal( check[:data][:note], organization.note, 'note' ) }
} }
end end
# check organization fields # check organization fields
test 'check organization fields' do test 'check organization fields' do
local_fields = Organization.column_names local_fields = Organization.column_names
# TODO
copmare_fields = %w( copmare_fields = %w(
id id
name name
@ -265,9 +262,11 @@ class ZendeskImportTest < ActiveSupport::TestCase
updated_by_id updated_by_id
created_by_id created_by_id
created_at created_at
updated_at) updated_at
api_key
custom_dropdown)
assert_equal( copmare_fields, local_fields, 'organization fields' ) assert_equal(copmare_fields, local_fields, 'organization fields')
end end
# check imported tickets # check imported tickets
@ -278,7 +277,8 @@ class ZendeskImportTest < ActiveSupport::TestCase
id: 2, id: 2,
data: { data: {
title: 'test', title: 'test',
note: 'This is the first comment. Feel free to delete this sample ticket.', #note: 'This is the first comment. Feel free to delete this sample ticket.',
note: 'test email',
create_article_type_id: 1, create_article_type_id: 1,
create_article_sender_id: 2, create_article_sender_id: 2,
article_count: 2, article_count: 2,
@ -288,13 +288,20 @@ class ZendeskImportTest < ActiveSupport::TestCase
owner_id: 1, owner_id: 1,
customer_id: 6, customer_id: 6,
organization_id: 2, organization_id: 2,
test_checkbox: 'f',
custom_integer: 999,
custom_dropdown: 'key2',
custom_decimal: '1.6',
not_existing: nil,
}, },
}, },
{ {
id: 3, id: 3,
data: { data: {
title: 'Bob Smith, here is the test ticket you requested', title: 'Bob Smith, here is the test ticket you requested',
note: 'test email', note: 'Hello! This is a Zendesk ticket. We are going to go through the basic support ticket operation in Zendesk.
If you\'re reading this message in your email, click the ticket number link that immediately follows the line \'You have been assigned to this t',
create_article_type_id: 10, create_article_type_id: 10,
create_article_sender_id: 2, create_article_sender_id: 2,
article_count: 4, article_count: 4,
@ -304,13 +311,18 @@ class ZendeskImportTest < ActiveSupport::TestCase
owner_id: 1, owner_id: 1,
customer_id: 7, customer_id: 7,
organization_id: nil, organization_id: nil,
test_checkbox: 'f',
custom_integer: nil,
custom_dropdown: '',
custom_decimal: nil,
not_existing: nil,
}, },
}, },
{ {
id: 5, id: 5,
data: { data: {
title: 'Twitter', title: 'Twitter',
note: '@DesafioCaracol sh q acaso sto se vale ver el jueg...', note: "@gabyalanisr Brandon Arely Snuppy Jaz Jerry Liz Irvig &amp; Wera\nY Losa Otrs Yop \npero si quieres Los Que Puedas",
create_article_type_id: 6, create_article_type_id: 6,
create_article_sender_id: 2, create_article_sender_id: 2,
article_count: 1, article_count: 1,
@ -357,18 +369,10 @@ class ZendeskImportTest < ActiveSupport::TestCase
] ]
checks.each { |check| checks.each { |check|
ticket = Ticket.find( check[:id] ) ticket = Ticket.find(check[:id])
check[:data].each {|key, value|
assert_equal( check[:data][:title], ticket.title, "title of Ticket.find(#{check[:id]})" ) assert_equal(value, ticket[key], "ticket.#{key} for ticket_id #{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 end
@ -404,27 +408,22 @@ class ZendeskImportTest < ActiveSupport::TestCase
checks.each { |check| checks.each { |check|
article = Ticket::Article.find(check[:id]) article = Ticket::Article.find(check[:id])
assert_equal( check[:data][:count], article.attachments.count, 'attachemnt count' ) assert_equal(check[:data][:count], article.attachments.count, 'attachemnt count')
(1..check[:data][:count] ).each { |attachment_counter| (1..check[:data][:count]).each { |attachment_counter|
attachment = article.attachments[ attachment_counter - 1 ] attachment = article.attachments[ attachment_counter - 1 ]
compare_attachment = check[:data][ attachment_counter ] compare_attachment = check[:data][ attachment_counter ]
assert_equal( compare_attachment[:filename], attachment.filename, 'attachment file name' ) assert_equal(compare_attachment[:filename], attachment.filename, 'attachment file name')
assert_equal(compare_attachment[:preferences], attachment[:preferences], 'attachment preferences')
assert_equal( compare_attachment[:preferences], attachment[:preferences], 'attachment preferences')
} }
} }
end end
# check ticket fields # check ticket fields
test 'check ticket fields' do test 'check ticket fields' do
local_fields = Ticket.column_names local_fields = Ticket.column_names
# TODO
copmare_fields = %w( copmare_fields = %w(
id id
group_id group_id
@ -463,9 +462,15 @@ class ZendeskImportTest < ActiveSupport::TestCase
updated_by_id updated_by_id
created_by_id created_by_id
created_at created_at
updated_at) updated_at
custom_decimal
test_checkbox
custom_date
custom_integer
custom_regex
custom_dropdown)
assert_equal( copmare_fields, local_fields, 'ticket fields' ) assert_equal(copmare_fields, local_fields, 'ticket fields')
end end
end end