Follow up - 8790e389be - Fixes issue #865 - Freshdesk import - Import last login date as such and not as image source.

This commit is contained in:
Thorsten Eckel 2021-05-26 17:15:58 +02:00
parent 85856cbd40
commit 77619212d6
2 changed files with 15 additions and 14 deletions

View file

@ -14,15 +14,15 @@ class Sequencer
provide_mapped do provide_mapped do
{ {
login: contact['email'], login: contact['email'],
firstname: contact['name'], firstname: contact['name'],
email: contact['email'], email: contact['email'],
phone: contact['phone'], phone: contact['phone'],
active: contact['active'], active: contact['active'],
group_ids: group_ids, group_ids: group_ids,
password: password, password: password,
image_source: contact['last_login_at'], last_login: contact['last_login_at'],
role_ids: ::Role.where(name: role_names).pluck(:id), role_ids: ::Role.where(name: role_names).pluck(:id),
} }
end end
end end

View file

@ -60,11 +60,12 @@ RSpec.describe ::Sequencer::Sequence::Import::Freshdesk::Agent, sequencer: :sequ
it 'imports user correctly' do # rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength it 'imports user correctly' do # rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength
expect { process(process_payload) }.to change(User, :count).by(1) expect { process(process_payload) }.to change(User, :count).by(1)
expect(User.last).to have_attributes( expect(User.last).to have_attributes(
firstname: 'John', firstname: 'John',
lastname: 'Doe', lastname: 'Doe',
login: 'freshdesk@example.com', login: 'freshdesk@example.com',
email: 'freshdesk@example.com', email: 'freshdesk@example.com',
active: true, active: true,
last_login: DateTime.parse('2021-05-10T07:52:58Z'),
) )
end end