Fllow up: Fixed issue #893 - OTRS Importer problem with CAPITAL letters in email addresses.

This commit is contained in:
Thorsten Eckel 2017-05-14 18:33:30 +02:00
parent 46e6a6fda4
commit adf8babab5
4 changed files with 77 additions and 0 deletions

View file

@ -67,6 +67,7 @@ module Import
mapped = map_default(customer)
mapped[:created_at] ||= DateTime.current
mapped[:updated_at] ||= DateTime.current
mapped[:email].downcase!
mapped
end

View file

@ -66,6 +66,12 @@ module Import
end
def map(user)
mapped = map_default(user)
mapped[:email].downcase!
mapped
end
def map_default(user)
{
created_by_id: 1,
updated_by_id: 1,

View file

@ -118,4 +118,41 @@ RSpec.describe Import::OTRS::CustomerUser do
updates_with(zammad_structure)
end
end
context 'regular user' do
let(:object_structure) { load_customer_json('capital_email') }
let(:zammad_structure) {
{
created_by_id: '1',
updated_by_id: '1',
active: true,
source: 'OTRS Import',
organization_id: 1337,
role_ids: [3],
updated_at: '2014-06-07 02:31:31',
created_at: '2014-06-07 02:31:31',
note: '',
email: 'qa100@t-online.de',
firstname: 'test669673',
lastname: 'test669673',
login: 'test669673',
password: 'f8be19af2f25837a31eff9131b0e47a5173290652c04a48b49b86474d48825ee',
phone: nil,
fax: nil,
mobile: nil,
street: nil,
zip: nil,
city: nil,
country: nil
}}
it 'creates' do
creates_with(zammad_structure)
end
it 'updates' do
updates_with(zammad_structure)
end
end
end

View file

@ -134,4 +134,37 @@ RSpec.describe Import::OTRS::User do
updates_with(zammad_structure)
end
end
context 'capital email' do
let(:object_structure) { load_user_json('capital_email') }
let(:zammad_structure) {
{
created_by_id: 1,
updated_by_id: 1,
active: true,
source: 'OTRS Import',
role_ids: [2, 1],
group_ids: ['1'],
password: '{sha2}9faaba2ab242a99bbb6992e9424386375f6757c17e6484ae570f39d9cad9f28ea',
updated_at: '2014-04-28 10:53:18',
created_at: '2014-04-28 10:53:18',
id: '1',
email: 'root@localhost',
firstname: 'Admin',
lastname: 'OTRS',
login: 'root@localhost'
}
}
it 'creates' do
prepare_expectations
creates_with(zammad_structure)
end
it 'updates' do
prepare_expectations
updates_with(zammad_structure)
end
end
end