mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
(#14) Remove printing in auth library
This commit is contained in:
parent
544d9d35b8
commit
3394a14ea0
3 changed files with 9 additions and 6 deletions
|
|
@ -280,12 +280,15 @@ class Vmfloaty
|
||||||
case action
|
case action
|
||||||
when "get"
|
when "get"
|
||||||
pass = password "Enter your password please:", '*'
|
pass = password "Enter your password please:", '*'
|
||||||
puts Auth.get_token(verbose, url, user, pass)
|
token = Auth.get_token(verbose, url, user, pass)
|
||||||
|
puts token
|
||||||
when "delete"
|
when "delete"
|
||||||
pass = password "Enter your password please:", '*'
|
pass = password "Enter your password please:", '*'
|
||||||
Auth.delete_token(verbose, url, user, pass, token)
|
result = Auth.delete_token(verbose, url, user, pass, token)
|
||||||
|
puts result
|
||||||
when "status"
|
when "status"
|
||||||
puts Auth.token_status(verbose, url, token)
|
status = Auth.token_status(verbose, url, token)
|
||||||
|
puts status
|
||||||
when nil
|
when nil
|
||||||
STDERR.puts "No action provided"
|
STDERR.puts "No action provided"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class Auth
|
||||||
response = conn.delete "/token/#{token}"
|
response = conn.delete "/token/#{token}"
|
||||||
res_body = JSON.parse(response.body)
|
res_body = JSON.parse(response.body)
|
||||||
if res_body["ok"]
|
if res_body["ok"]
|
||||||
puts res_body
|
return res_body
|
||||||
else
|
else
|
||||||
STDERR.puts "There was a problem with your request:"
|
STDERR.puts "There was a problem with your request:"
|
||||||
puts res_body
|
puts res_body
|
||||||
|
|
@ -49,7 +49,7 @@ class Auth
|
||||||
res_body = JSON.parse(response.body)
|
res_body = JSON.parse(response.body)
|
||||||
|
|
||||||
if res_body["ok"]
|
if res_body["ok"]
|
||||||
res_body
|
return res_body
|
||||||
else
|
else
|
||||||
STDERR.puts "There was a problem with your request:"
|
STDERR.puts "There was a problem with your request:"
|
||||||
puts res_body
|
puts res_body
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ describe Pooler do
|
||||||
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'}).
|
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'}).
|
||||||
to_return(:status => 200, :body => @delete_token_response, :headers => {})
|
to_return(:status => 200, :body => @delete_token_response, :headers => {})
|
||||||
|
|
||||||
#expect(Auth.delete_token(false, @vmpooler_url, "first.last", "password", @token)).to eq @delete_token_response
|
expect(Auth.delete_token(false, @vmpooler_url, "first.last", "password", @token)).to eq JSON.parse(@delete_token_response)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue