Revision 977f12ed
Added by Amir Fefer about 8 years ago
test/unit/nics/bmc_test.rb | ||
---|---|---|
end
|
||
end
|
||
|
||
context "bmc password encryption" do
|
||
def setup
|
||
host = FactoryGirl.build(:host, :managed)
|
||
@bmc_nic = FactoryGirl.build(:nic_bmc, :with_subnet, :host => host)
|
||
@bmc_nic.expects(:encryption_key).at_least_once.returns('25d224dd383e92a7e0c82b8bf7c985e815f34cf5')
|
||
@bmc_nic.expects(:validate_bmc_proxy).at_least_once.returns(true)
|
||
@bmc_nic.save
|
||
end
|
||
|
||
test 'BMC password is encrypted in DB' do
|
||
assert @bmc_nic.password_in_db.include? Encryptable::ENCRYPTION_PREFIX
|
||
end
|
||
|
||
test 'BMC password is decrypted in ENC' do
|
||
bmc_nic_enc = @bmc_nic.to_enc
|
||
assert_equal bmc_nic_enc['password'], 'admin'
|
||
end
|
||
end
|
||
|
||
context "no BMC smart proxy exists" do
|
||
def setup
|
||
SmartProxy.with_features('BMC').destroy_all
|
Also available in: Unified diff
Fixes #1329 - encrypt BMC password in DB