Bug #18489

auth_source_ldaps controller test sets account_password to nil to test missing parameter

Added by Dominic Cleal about 1 year ago. Updated about 1 year ago.

Status:Closed
Priority:Low
Assigned To:Dominic Cleal
Category:Tests
Target version:-
Difficulty: Bugzilla link:
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4279
Story points-
Velocity based estimate-
Release1.15.0Release relationshipAuto

Description

The test "AuthSourceLdapsControllerTest#test_0001_blank account_password submitted does not erase existing account_password" wasn't updated in commit 2348fc8e (#2943, #11387) to test the difference between a missing account_password parameter and an empty string parameter.

It passes account_password => nil into parameters and then tests that the password is unchanged. Under Rails 5.0, nil is changed to an empty string (because it's form encoded) but under 4.2 it's passed through as nil (which isn't really possible in form encoding). This causes a failure on 5.0 as it resets the password from the original nil to "":

AuthSourceLdapsControllerTest#test_0001_blank account_password submitted does not erase existing account_password [test/controllers/auth_source_ldaps_controller_test.rb:82]:
Expected: nil
Actual: ""

The test should have been updated like other controllers to test with a missing account_password (which should not change the password) and an empty string account_password (which should set it to an empty string). It shouldn't test a nil value.


Related issues

Related to Foreman - Bug #11387: LDAP Account password cannot be empty after edit Closed 08/17/2015

Associated revisions

Revision 5c5f8c0b
Added by Dominic Cleal about 1 year ago

fixes #18489 - test AuthSourceLdap missing and blank passwords

After 2348fc8e, providing an empty password during update would erase
the existing password. Other resource type tests were updated, but not
AuthSourceLdap, so these now reflect the current behaviour.

These started failing on Rails 5 as the test params passed converted a
value of nil (not really possible) to an empty string, causing the
password to be blanked. On develop, the original password was nil
and the update to another nil value was a no-op.

History

#1 Updated by Dominic Cleal about 1 year ago

  • Related to Bug #11387: LDAP Account password cannot be empty after edit added

#2 Updated by The Foreman Bot about 1 year ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4279 added

#3 Updated by Dominic Cleal about 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Dominic Cleal about 1 year ago

  • Release set to 1.15.0

Also available in: Atom PDF