Fixed issue #519 - Mails get imported as text/html instead of text/plain.

This commit is contained in:
Thorsten Eckel 2016-12-09 13:16:33 +01:00
parent 9b9f9ed8c5
commit 0646b9dc25
2 changed files with 22 additions and 37 deletions

View file

@ -5,21 +5,22 @@ module Import
include Import::OTRS::Helper
MAPPING = {
TicketID: :ticket_id,
ArticleID: :id,
Body: :body,
From: :from,
To: :to,
Cc: :cc,
Subject: :subject,
InReplyTo: :in_reply_to,
MessageID: :message_id,
#ReplyTo: :reply_to,
References: :references,
Changed: :updated_at,
Created: :created_at,
ChangedBy: :updated_by_id,
CreatedBy: :created_by_id,
TicketID: :ticket_id,
ArticleID: :id,
Body: :body,
From: :from,
To: :to,
Cc: :cc,
Subject: :subject,
InReplyTo: :in_reply_to,
MessageID: :message_id,
#ReplyTo: :reply_to,
References: :references,
ContentType: :content_type,
Changed: :updated_at,
Created: :created_at,
ChangedBy: :updated_by_id,
CreatedBy: :created_by_id,
}.freeze
def initialize(article)

View file

@ -27,9 +27,8 @@ RSpec.describe Import::OTRS::Article do
context 'customer phone' do
let(:object_structure) { load_article_json('customer_phone_attachment') }
it 'creates' do
zammad_structure = {
let(:zammad_structure) {
{
created_by_id: '3',
updated_by_id: 1,
ticket_id: '730',
@ -38,6 +37,7 @@ RSpec.describe Import::OTRS::Article do
from: '"Betreuter Kunde" <kunde2@kunde.de>,',
to: 'Postmaster',
cc: '',
content_type: 'text/plain; charset=utf-8',
subject: 'test #3',
in_reply_to: '',
message_id: '',
@ -48,30 +48,14 @@ RSpec.describe Import::OTRS::Article do
internal: false,
sender_id: 2
}
}
it 'creates' do
expect(Import::OTRS::Article::AttachmentFactory).to receive(:import)
creates_with(zammad_structure)
end
it 'updates' do
zammad_structure = {
created_by_id: '3',
updated_by_id: 1,
ticket_id: '730',
id: '3970',
body: 'test #3',
from: '"Betreuter Kunde" <kunde2@kunde.de>,',
to: 'Postmaster',
cc: '',
subject: 'test #3',
in_reply_to: '',
message_id: '',
references: '',
updated_at: '2014-11-21 00:21:08',
created_at: '2014-11-21 00:17:41',
type_id: 5,
internal: false,
sender_id: 2
}
expect(Import::OTRS::Article::AttachmentFactory).to receive(:import)
updates_with(zammad_structure)
end