mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
(#33) Raise TokenError if no token provided
This commit is contained in:
parent
8da1deaf6b
commit
579320e988
2 changed files with 10 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ class Auth
|
||||||
|
|
||||||
def self.delete_token(verbose, url, user, password, token)
|
def self.delete_token(verbose, url, user, password, token)
|
||||||
if token.nil?
|
if token.nil?
|
||||||
STDERR.puts 'You did not provide a token'
|
raise TokenError, 'You did not provide a token'
|
||||||
end
|
end
|
||||||
|
|
||||||
conn = Http.get_conn_with_auth(verbose, url, user, password)
|
conn = Http.get_conn_with_auth(verbose, url, user, password)
|
||||||
|
|
@ -35,7 +35,7 @@ class Auth
|
||||||
|
|
||||||
def self.token_status(verbose, url, token)
|
def self.token_status(verbose, url, token)
|
||||||
if token.nil?
|
if token.nil?
|
||||||
STDERR.puts 'You did not provide a token'
|
raise TokenError, 'You did not provide a token'
|
||||||
end
|
end
|
||||||
|
|
||||||
conn = Http.get_conn(verbose, url)
|
conn = Http.get_conn(verbose, url)
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,10 @@ describe Pooler do
|
||||||
|
|
||||||
expect{ Auth.delete_token(false, @vmpooler_url, "first.last", "password", @token) }.to raise_error(TokenError)
|
expect{ Auth.delete_token(false, @vmpooler_url, "first.last", "password", @token) }.to raise_error(TokenError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "raises a token error if no token provided" do
|
||||||
|
expect{ Auth.delete_token(false, @vmpooler_url, "first.last", "password", nil) }.to raise_error(TokenError)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#token_status" do
|
describe "#token_status" do
|
||||||
|
|
@ -74,5 +78,9 @@ describe Pooler do
|
||||||
|
|
||||||
expect{ Auth.token_status(false, @vmpooler_url, @token) }.to raise_error(TokenError)
|
expect{ Auth.token_status(false, @vmpooler_url, @token) }.to raise_error(TokenError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "raises a token error if no token provided" do
|
||||||
|
expect{ Auth.token_status(false, @vmpooler_url, nil) }.to raise_error(TokenError)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue