mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[Brightbox] Fixes Account#reset_ftp_password
Tests that Account#reset_ftp_password is working (had an issue previously) and now merges the results in making the password value available on the model whilst it exists.
This commit is contained in:
parent
0cb518a3d2
commit
4b79b6ba04
2 changed files with 24 additions and 3 deletions
|
@ -32,7 +32,7 @@ module Fog
|
|||
attribute :load_balancers_used
|
||||
attribute :library_ftp_host
|
||||
attribute :library_ftp_user
|
||||
# This is always returned as null/nil unless performing a reset_ftp_password request
|
||||
# This is always returned as nil unless after a call to reset_ftp_password
|
||||
attribute :library_ftp_password
|
||||
|
||||
# Boolean flags
|
||||
|
@ -51,13 +51,19 @@ module Fog
|
|||
attribute :users
|
||||
attribute :zones
|
||||
|
||||
# Resets the account's image library FTP password returning the new value
|
||||
#
|
||||
# @return [String] Newly issue FTP password
|
||||
#
|
||||
def reset_ftp_password
|
||||
requires :identity
|
||||
connection.reset_ftp_password_account["library_ftp_password"]
|
||||
data = connection.reset_ftp_password_account(identity)
|
||||
merge_attributes(data)
|
||||
library_ftp_password
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
tests/brightbox/models/compute/account_tests.rb
Normal file
15
tests/brightbox/models/compute/account_tests.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
Shindo.tests("Fog::Compute[:brightbox] | Account model", ["brightbox"]) do
|
||||
|
||||
@account = Fog::Compute[:brightbox].account
|
||||
|
||||
tests("success") do
|
||||
|
||||
tests("#reset_ftp_password") do
|
||||
pending if Fog.mocking?
|
||||
test("original ftp password is blanked") { @account.library_ftp_password.nil? }
|
||||
@new_password = @account.reset_ftp_password
|
||||
test("new ftp password was not nil") { !@new_password.nil? }
|
||||
test("new ftp password is set") { @account.library_ftp_password == @new_password }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue