Defect #37449

Passing a wrong parameter to `with_settings` in UserTest::test_random_password_include_required_characters

Added by Go MAEDA 25 days ago. Updated 25 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.2.8
Resolution:Fixed Affected version:

Description

Setting.password_required_char_classes stores an array like ["uppercase", "lowercase", "digits"] but UserTest::test_random_password_include_required_characters passes a hash.

diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index dde1cdd62..53e7693ff 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -1099,7 +1099,7 @@ class UserTest < ActiveSupport::TestCase
   end

   def test_random_password_include_required_characters
-    with_settings :password_required_char_classes => Setting::PASSWORD_CHAR_CLASSES do
+    with_settings :password_required_char_classes => Setting::PASSWORD_CHAR_CLASSES.keys do
       u = User.new(:firstname => "new", :lastname => "user", :login => "random", :mail => "random@somnet.foo")
       u.random_password
       assert u.valid?

Related issues

Related to Redmine - Feature #4221: Force passwords to contain specified character classes Closed 2009-11-16

Associated revisions

Revision 21705
Added by Go MAEDA 25 days ago

Fix passing a wrong parameter to `with_settings` in UserTest::test_random_password_include_required_characters (#37449).

Patch by Go MAEDA.

Revision 21711
Added by Go MAEDA 25 days ago

Merged r21705 from trunk to 5.0-stable (#37449).

Revision 21712
Added by Go MAEDA 25 days ago

Merged r21705 from trunk to 4.2-stable (#37449).

History

#1 Updated by Go MAEDA 25 days ago

  • Subject changed from Passes wrong parameter to `with_settings` in UserTest::test_random_password_include_required_characters to Passing a wrong parameter to `with_settings` in UserTest::test_random_password_include_required_characters
  • Status changed from New to Resolved
  • Assignee set to Go MAEDA

#2 Updated by Go MAEDA 25 days ago

  • Related to Feature #4221: Force passwords to contain specified character classes added

#3 Updated by Go MAEDA 25 days ago

  • Status changed from Resolved to Closed
  • Resolution set to Fixed

Also available in: Atom PDF