From 66988facc1271fd18f86b4d4d903e38fccf6b32d Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 9 Jan 2018 12:20:04 +0100 Subject: [PATCH] Ensures resolved issue #1665 - Added RSpec test to ensure LDAP attributes get reset if no value is provided from remote. --- .../unit/import/ldap/user/mapping_spec.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb diff --git a/spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb b/spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb new file mode 100644 index 000000000..8ec256d92 --- /dev/null +++ b/spec/lib/sequencer/unit/import/ldap/user/mapping_spec.rb @@ -0,0 +1,27 @@ +require 'rails_helper' + +RSpec.describe Sequencer::Unit::Import::Ldap::User::Mapping, sequencer: :unit do + + it 'ensures to unset attribute value if none is provided' do + + ldap_config = { + user_attributes: { + firstName: 'firstname', + lastName: 'lastname', + samaccountname: 'login', + } + } + + resource = { + samaccountname: 'Some41', + firstName: 'Some', + } + + provided = process( + ldap_config: ldap_config, + resource: resource, + ) + + expect(provided['lastname']).to be_nil + end +end