Skip to content

Commit

Permalink
test: refactor minitest 6
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanrobert committed Oct 28, 2019
1 parent 98135a7 commit 8060575
Show file tree
Hide file tree
Showing 22 changed files with 5,622 additions and 6,245 deletions.
9 changes: 5 additions & 4 deletions lib/fog/proxmox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ class << self
attr_reader :credentials
attr_reader :version
attr_accessor :now # tests only
attr_accessor :ticket_lifetime # tests only
end

def self.clear_credentials
@credentials = {}
end

def self.authenticate(options, connection_options = {})
get_tokens(options, connection_options)
get_credentials(options, connection_options)
self
end

Expand All @@ -71,7 +72,7 @@ def self.extract_password(options)
options[:pve_password] = ticket unless ticket
end

def self.get_tokens(options, connection_options = {})
def self.get_credentials(options, connection_options = {})
username = options[:pve_username].to_s
password = options[:pve_password].to_s
url = options[:pve_url]
Expand Down Expand Up @@ -102,10 +103,10 @@ def self.request_credentials(uri, connection_options, username, password)
username = data['username']
csrftoken = data['CSRFPreventionToken']
deadline = Time.at(@now.to_i + @ticket_lifetime)
save_token(username, ticket, csrftoken, deadline)
save_credentials(username, ticket, csrftoken, deadline)
end

def self.save_token(username, ticket, csrftoken, deadline)
def self.save_credentials(username, ticket, csrftoken, deadline)
@credentials = {
username: username,
ticket: ticket,
Expand Down
Loading

0 comments on commit 8060575

Please sign in to comment.