From 58e18b4f278757b1a4f8dc9c6411286c6b2f935c Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Wed, 25 Mar 2020 13:11:59 +0100 Subject: [PATCH] Follow up - 13ddd3af38e6864e7bf33ac4461f12e623b41d77 - Fixed issue #2981 - OTRS migration priority color wrong for 3 normal. --- lib/import/otrs/priority.rb | 2 + spec/fixtures/import/otrs/priority/low.json | 9 ++++ .../fixtures/import/otrs/priority/normal.json | 9 ++++ spec/lib/import/otrs/priority_spec.rb | 44 +++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 spec/fixtures/import/otrs/priority/low.json create mode 100644 spec/fixtures/import/otrs/priority/normal.json diff --git a/lib/import/otrs/priority.rb b/lib/import/otrs/priority.rb index 35cf917e7..225e89e24 100644 --- a/lib/import/otrs/priority.rb +++ b/lib/import/otrs/priority.rb @@ -49,12 +49,14 @@ module Import def ui_color(priority) return 'high-priority' if ['4 high', '5 very high'].include?(priority['Name']) + return 'low-priority' if ['2 low', '1 very low'].include?(priority['Name']) nil end def ui_icon(priority) return 'important' if ['4 high', '5 very high'].include?(priority['Name']) + return 'low-priority' if ['2 low', '1 very low'].include?(priority['Name']) nil end diff --git a/spec/fixtures/import/otrs/priority/low.json b/spec/fixtures/import/otrs/priority/low.json new file mode 100644 index 000000000..2708a31db --- /dev/null +++ b/spec/fixtures/import/otrs/priority/low.json @@ -0,0 +1,9 @@ +{ + "ChangeBy": "1", + "ChangeTime": "2014-04-28 10:53:18", + "ID": "2", + "ValidID": "1", + "CreateTime": "2014-04-28 10:53:18", + "CreateBy": "1", + "Name": "2 low" +} diff --git a/spec/fixtures/import/otrs/priority/normal.json b/spec/fixtures/import/otrs/priority/normal.json new file mode 100644 index 000000000..477a52d7a --- /dev/null +++ b/spec/fixtures/import/otrs/priority/normal.json @@ -0,0 +1,9 @@ +{ + "ChangeBy": "1", + "ChangeTime": "2014-04-28 10:53:18", + "ID": "3", + "ValidID": "1", + "CreateTime": "2014-04-28 10:53:18", + "CreateBy": "1", + "Name": "3 normal" +} diff --git a/spec/lib/import/otrs/priority_spec.rb b/spec/lib/import/otrs/priority_spec.rb index 9c0348c79..69cf67f85 100644 --- a/spec/lib/import/otrs/priority_spec.rb +++ b/spec/lib/import/otrs/priority_spec.rb @@ -49,4 +49,48 @@ RSpec.describe Import::OTRS::Priority do updates_with(zammad_structure) end end + + context 'normal' do + + let(:object_structure) { load_priority_json('normal') } + let(:zammad_structure) do + { + created_by_id: '1', + updated_by_id: '1', + active: true, + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + ui_color: nil, + ui_icon: nil, + name: '3 normal', + id: '3' + } + end + + it 'updates' do + updates_with(zammad_structure) + end + end + + context 'low' do + + let(:object_structure) { load_priority_json('low') } + let(:zammad_structure) do + { + created_by_id: '1', + updated_by_id: '1', + active: true, + updated_at: '2014-04-28 10:53:18', + created_at: '2014-04-28 10:53:18', + ui_color: 'low-priority', + ui_icon: 'low-priority', + name: '2 low', + id: '2' + } + end + + it 'updates' do + updates_with(zammad_structure) + end + end end