Fixed: Error when reading ciphered text from the database without cipher key configured (#9552).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7780 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -53,6 +53,20 @@ class Redmine::CipheringTest < ActiveSupport::TestCase
|
||||
assert_equal 'clear', r.password
|
||||
end
|
||||
end
|
||||
|
||||
def test_ciphered_password_with_no_cipher_key_configured_should_be_returned_ciphered
|
||||
Redmine::Configuration.with 'database_cipher_key' => 'secret' do
|
||||
r = Repository::Subversion.generate!(:password => 'clear')
|
||||
end
|
||||
|
||||
Redmine::Configuration.with 'database_cipher_key' => '' do
|
||||
r = Repository.first(:order => 'id DESC')
|
||||
# password can not be deciphered
|
||||
assert_nothing_raised do
|
||||
assert r.password.match(/\Aaes-256-cbc:.+\Z/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_encrypt_all
|
||||
Repository.delete_all
|
||||
|
||||
Reference in New Issue
Block a user