mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
Merge pull request #54 from highb/update_faraday
Update Faraday to 0.15, remove unnecessary headers
This commit is contained in:
commit
d8dd0885ab
4 changed files with 18 additions and 41 deletions
|
|
@ -16,7 +16,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'returns a token from vmpooler' do
|
it 'returns a token from vmpooler' do
|
||||||
stub_request(:post, 'https://first.last:password@vmpooler.example.com/token')
|
stub_request(:post, 'https://first.last:password@vmpooler.example.com/token')
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 200, :body => @get_token_response, :headers => {})
|
.to_return(:status => 200, :body => @get_token_response, :headers => {})
|
||||||
|
|
||||||
token = Auth.get_token(false, @vmpooler_url, 'first.last', 'password')
|
token = Auth.get_token(false, @vmpooler_url, 'first.last', 'password')
|
||||||
|
|
@ -25,7 +24,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'raises a token error if something goes wrong' do
|
it 'raises a token error if something goes wrong' do
|
||||||
stub_request(:post, 'https://first.last:password@vmpooler.example.com/token')
|
stub_request(:post, 'https://first.last:password@vmpooler.example.com/token')
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 500, :body => '{"ok":false}', :headers => {})
|
.to_return(:status => 500, :body => '{"ok":false}', :headers => {})
|
||||||
|
|
||||||
expect { Auth.get_token(false, @vmpooler_url, 'first.last', 'password') }.to raise_error(TokenError)
|
expect { Auth.get_token(false, @vmpooler_url, 'first.last', 'password') }.to raise_error(TokenError)
|
||||||
|
|
@ -40,7 +38,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'deletes the specified token' do
|
it 'deletes the specified token' do
|
||||||
stub_request(:delete, 'https://first.last:password@vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y')
|
stub_request(:delete, 'https://first.last:password@vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y')
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.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 JSON.parse(@delete_token_response)
|
expect(Auth.delete_token(false, @vmpooler_url, 'first.last', 'password', @token)).to eq JSON.parse(@delete_token_response)
|
||||||
|
|
@ -48,7 +45,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'raises a token error if something goes wrong' do
|
it 'raises a token error if something goes wrong' do
|
||||||
stub_request(:delete, 'https://first.last:password@vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y')
|
stub_request(:delete, 'https://first.last:password@vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y')
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 500, :body => '{"ok":false}', :headers => {})
|
.to_return(:status => 500, :body => '{"ok":false}', :headers => {})
|
||||||
|
|
||||||
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)
|
||||||
|
|
@ -67,7 +63,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'checks the status of a token' do
|
it 'checks the status of a token' do
|
||||||
stub_request(:get, "#{@vmpooler_url}/token/utpg2i2xswor6h8ttjhu3d47z53yy47y")
|
stub_request(:get, "#{@vmpooler_url}/token/utpg2i2xswor6h8ttjhu3d47z53yy47y")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 200, :body => @token_status_response, :headers => {})
|
.to_return(:status => 200, :body => @token_status_response, :headers => {})
|
||||||
|
|
||||||
expect(Auth.token_status(false, @vmpooler_url, @token)).to eq JSON.parse(@token_status_response)
|
expect(Auth.token_status(false, @vmpooler_url, @token)).to eq JSON.parse(@token_status_response)
|
||||||
|
|
@ -75,7 +70,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'raises a token error if something goes wrong' do
|
it 'raises a token error if something goes wrong' do
|
||||||
stub_request(:get, "#{@vmpooler_url}/token/utpg2i2xswor6h8ttjhu3d47z53yy47y")
|
stub_request(:get, "#{@vmpooler_url}/token/utpg2i2xswor6h8ttjhu3d47z53yy47y")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 500, :body => '{"ok":false}', :headers => {})
|
.to_return(:status => 500, :body => '{"ok":false}', :headers => {})
|
||||||
|
|
||||||
expect { Auth.token_status(false, @vmpooler_url, @token) }.to raise_error(TokenError)
|
expect { Auth.token_status(false, @vmpooler_url, @token) }.to raise_error(TokenError)
|
||||||
|
|
|
||||||
|
|
@ -8,21 +8,9 @@ require 'vmfloaty/nonstandard_pooler'
|
||||||
describe NonstandardPooler do
|
describe NonstandardPooler do
|
||||||
before :each do
|
before :each do
|
||||||
@nspooler_url = 'https://nspooler.example.com'
|
@nspooler_url = 'https://nspooler.example.com'
|
||||||
@post_request_headers = {
|
@auth_token_headers = {
|
||||||
'Accept' => '*/*',
|
'X-Auth-Token' => 'token-value',
|
||||||
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
|
||||||
'User-Agent' => 'Faraday v0.9.2',
|
|
||||||
'X-Auth-Token' => 'token-value',
|
|
||||||
}
|
}
|
||||||
@get_request_headers = {
|
|
||||||
'Accept' => '*/*',
|
|
||||||
'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
|
||||||
'User-Agent' => 'Faraday v0.9.2',
|
|
||||||
'X-Auth-Token' => 'token-value',
|
|
||||||
}
|
|
||||||
@get_request_headers_notoken = @get_request_headers.tap do |headers|
|
|
||||||
headers.delete('X-Auth-Token')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#list' do
|
describe '#list' do
|
||||||
|
|
@ -133,7 +121,7 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'raises an AuthError if the token is invalid' do
|
it 'raises an AuthError if the token is invalid' do
|
||||||
stub_request(:post, "#{@nspooler_url}/host/solaris-11-sparc")
|
stub_request(:post, "#{@nspooler_url}/host/solaris-11-sparc")
|
||||||
.with(:headers => @post_request_headers)
|
.with(:headers => @auth_token_headers)
|
||||||
.to_return(:status => 401, :body => '{"ok":false,"reason": "token: token-value does not exist"}', :headers => {})
|
.to_return(:status => 401, :body => '{"ok":false,"reason": "token: token-value does not exist"}', :headers => {})
|
||||||
|
|
||||||
vm_hash = { 'solaris-11-sparc' => 1 }
|
vm_hash = { 'solaris-11-sparc' => 1 }
|
||||||
|
|
@ -142,7 +130,7 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'retrieves a single vm with a token' do
|
it 'retrieves a single vm with a token' do
|
||||||
stub_request(:post, "#{@nspooler_url}/host/solaris-11-sparc")
|
stub_request(:post, "#{@nspooler_url}/host/solaris-11-sparc")
|
||||||
.with(:headers => @post_request_headers)
|
.with(:headers => @auth_token_headers)
|
||||||
.to_return(:status => 200, :body => @retrieve_response_body_single, :headers => {})
|
.to_return(:status => 200, :body => @retrieve_response_body_single, :headers => {})
|
||||||
|
|
||||||
vm_hash = { 'solaris-11-sparc' => 1 }
|
vm_hash = { 'solaris-11-sparc' => 1 }
|
||||||
|
|
@ -154,7 +142,7 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'retrieves a multiple vms with a token' do
|
it 'retrieves a multiple vms with a token' do
|
||||||
stub_request(:post, "#{@nspooler_url}/host/aix-7.1-power+solaris-10-sparc+solaris-10-sparc")
|
stub_request(:post, "#{@nspooler_url}/host/aix-7.1-power+solaris-10-sparc+solaris-10-sparc")
|
||||||
.with(:headers => @post_request_headers)
|
.with(:headers => @auth_token_headers)
|
||||||
.to_return(:status => 200, :body => @retrieve_response_body_many, :headers => {})
|
.to_return(:status => 200, :body => @retrieve_response_body_many, :headers => {})
|
||||||
|
|
||||||
vm_hash = { 'aix-7.1-power' => 1, 'solaris-10-sparc' => 2 }
|
vm_hash = { 'aix-7.1-power' => 1, 'solaris-10-sparc' => 2 }
|
||||||
|
|
@ -175,7 +163,7 @@ describe NonstandardPooler do
|
||||||
it 'raises an error if the user tries to modify an unsupported attribute' do
|
it 'raises an error if the user tries to modify an unsupported attribute' do
|
||||||
stub_request(:put, 'https://nspooler.example.com/host/myfakehost')
|
stub_request(:put, 'https://nspooler.example.com/host/myfakehost')
|
||||||
.with(:body => { '{}' => true },
|
.with(:body => { '{}' => true },
|
||||||
:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'token-value' })
|
:headers => @auth_token_headers)
|
||||||
.to_return(:status => 200, :body => '', :headers => {})
|
.to_return(:status => 200, :body => '', :headers => {})
|
||||||
details = { :lifetime => 12 }
|
details = { :lifetime => 12 }
|
||||||
expect { NonstandardPooler.modify(false, @nspooler_url, 'myfakehost', 'token-value', details) }
|
expect { NonstandardPooler.modify(false, @nspooler_url, 'myfakehost', 'token-value', details) }
|
||||||
|
|
@ -186,7 +174,7 @@ describe NonstandardPooler do
|
||||||
modify_request_body = { '{"reserved_for_reason":"testing"}' => true }
|
modify_request_body = { '{"reserved_for_reason":"testing"}' => true }
|
||||||
stub_request(:put, "#{@nspooler_url}/host/myfakehost")
|
stub_request(:put, "#{@nspooler_url}/host/myfakehost")
|
||||||
.with(:body => modify_request_body,
|
.with(:body => modify_request_body,
|
||||||
:headers => @post_request_headers)
|
:headers => @auth_token_headers)
|
||||||
.to_return(:status => 200, :body => '{"ok": true}', :headers => {})
|
.to_return(:status => 200, :body => '{"ok": true}', :headers => {})
|
||||||
|
|
||||||
modify_hash = { :reason => 'testing' }
|
modify_hash = { :reason => 'testing' }
|
||||||
|
|
@ -220,7 +208,6 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'prints the status' do
|
it 'prints the status' do
|
||||||
stub_request(:get, "#{@nspooler_url}/status")
|
stub_request(:get, "#{@nspooler_url}/status")
|
||||||
.with(:headers => @get_request_headers)
|
|
||||||
.to_return(:status => 200, :body => @status_response_body, :headers => {})
|
.to_return(:status => 200, :body => @status_response_body, :headers => {})
|
||||||
|
|
||||||
status = NonstandardPooler.status(false, @nspooler_url)
|
status = NonstandardPooler.status(false, @nspooler_url)
|
||||||
|
|
@ -244,7 +231,6 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'prints the summary' do
|
it 'prints the summary' do
|
||||||
stub_request(:get, "#{@nspooler_url}/summary")
|
stub_request(:get, "#{@nspooler_url}/summary")
|
||||||
.with(:headers => @get_request_headers)
|
|
||||||
.to_return(:status => 200, :body => @status_response_body, :headers => {})
|
.to_return(:status => 200, :body => @status_response_body, :headers => {})
|
||||||
|
|
||||||
summary = NonstandardPooler.summary(false, @nspooler_url)
|
summary = NonstandardPooler.summary(false, @nspooler_url)
|
||||||
|
|
@ -270,7 +256,6 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'makes a query about a vm' do
|
it 'makes a query about a vm' do
|
||||||
stub_request(:get, "#{@nspooler_url}/host/sol10-11")
|
stub_request(:get, "#{@nspooler_url}/host/sol10-11")
|
||||||
.with(:headers => @get_request_headers_notoken)
|
|
||||||
.to_return(:status => 200, :body => @query_response_body, :headers => {})
|
.to_return(:status => 200, :body => @query_response_body, :headers => {})
|
||||||
|
|
||||||
query_req = NonstandardPooler.query(false, @nspooler_url, 'sol10-11')
|
query_req = NonstandardPooler.query(false, @nspooler_url, 'sol10-11')
|
||||||
|
|
@ -286,7 +271,7 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'deletes a single existing vm' do
|
it 'deletes a single existing vm' do
|
||||||
stub_request(:delete, "#{@nspooler_url}/host/sol11-7")
|
stub_request(:delete, "#{@nspooler_url}/host/sol11-7")
|
||||||
.with(:headers => @post_request_headers)
|
.with(:headers => @auth_token_headers)
|
||||||
.to_return(:status => 200, :body => @delete_response_success, :headers => {})
|
.to_return(:status => 200, :body => @delete_response_success, :headers => {})
|
||||||
|
|
||||||
request = NonstandardPooler.delete(false, @nspooler_url, 'sol11-7', 'token-value')
|
request = NonstandardPooler.delete(false, @nspooler_url, 'sol11-7', 'token-value')
|
||||||
|
|
@ -295,7 +280,7 @@ describe NonstandardPooler do
|
||||||
|
|
||||||
it 'does not delete a nonexistant vm' do
|
it 'does not delete a nonexistant vm' do
|
||||||
stub_request(:delete, "#{@nspooler_url}/host/fakehost")
|
stub_request(:delete, "#{@nspooler_url}/host/fakehost")
|
||||||
.with(:headers => @post_request_headers)
|
.with(:headers => @auth_token_headers)
|
||||||
.to_return(:status => 401, :body => @delete_response_failure, :headers => {})
|
.to_return(:status => 401, :body => @delete_response_failure, :headers => {})
|
||||||
|
|
||||||
request = NonstandardPooler.delete(false, @nspooler_url, 'fakehost', 'token-value')
|
request = NonstandardPooler.delete(false, @nspooler_url, 'fakehost', 'token-value')
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'raises an AuthError if the token is invalid' do
|
it 'raises an AuthError if the token is invalid' do
|
||||||
stub_request(:post, "#{@vmpooler_url}/vm/debian-7-i386")
|
stub_request(:post, "#{@vmpooler_url}/vm/debian-7-i386")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 401, :body => '{"ok":false}', :headers => {})
|
.to_return(:status => 401, :body => '{"ok":false}', :headers => {})
|
||||||
|
|
||||||
vm_hash = {}
|
vm_hash = {}
|
||||||
|
|
@ -58,7 +58,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'retrieves a single vm with a token' do
|
it 'retrieves a single vm with a token' do
|
||||||
stub_request(:post, "#{@vmpooler_url}/vm/debian-7-i386")
|
stub_request(:post, "#{@vmpooler_url}/vm/debian-7-i386")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 200, :body => @retrieve_response_body_single, :headers => {})
|
.to_return(:status => 200, :body => @retrieve_response_body_single, :headers => {})
|
||||||
|
|
||||||
vm_hash = {}
|
vm_hash = {}
|
||||||
|
|
@ -71,7 +71,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'retrieves a multiple vms with a token' do
|
it 'retrieves a multiple vms with a token' do
|
||||||
stub_request(:post, "#{@vmpooler_url}/vm/debian-7-i386+debian-7-i386+centos-7-x86_64")
|
stub_request(:post, "#{@vmpooler_url}/vm/debian-7-i386+debian-7-i386+centos-7-x86_64")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 200, :body => @retrieve_response_body_double, :headers => {})
|
.to_return(:status => 200, :body => @retrieve_response_body_double, :headers => {})
|
||||||
|
|
||||||
vm_hash = {}
|
vm_hash = {}
|
||||||
|
|
@ -100,7 +100,7 @@ describe Pooler do
|
||||||
modify_hash = { :lifetime => 12 }
|
modify_hash = { :lifetime => 12 }
|
||||||
stub_request(:put, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6")
|
stub_request(:put, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6")
|
||||||
.with(:body => { '{"lifetime":12}' => true },
|
.with(:body => { '{"lifetime":12}' => true },
|
||||||
:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
:headers => { 'Content-Type' => 'application/x-www-form-urlencoded', 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 200, :body => @modify_response_body_success, :headers => {})
|
.to_return(:status => 200, :body => @modify_response_body_success, :headers => {})
|
||||||
|
|
||||||
modify_req = Pooler.modify(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', modify_hash)
|
modify_req = Pooler.modify(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', modify_hash)
|
||||||
|
|
@ -116,7 +116,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'deletes a specified vm' do
|
it 'deletes a specified vm' do
|
||||||
stub_request(:delete, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6")
|
stub_request(:delete, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 200, :body => @delete_response_body_success, :headers => {})
|
.to_return(:status => 200, :body => @delete_response_body_success, :headers => {})
|
||||||
|
|
||||||
expect(Pooler.delete(false, @vmpooler_url, ['fq6qlpjlsskycq6'], 'mytokenfile')).to eq @delete_response
|
expect(Pooler.delete(false, @vmpooler_url, ['fq6qlpjlsskycq6'], 'mytokenfile')).to eq @delete_response
|
||||||
|
|
@ -135,7 +135,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'prints the status' do
|
it 'prints the status' do
|
||||||
stub_request(:get, "#{@vmpooler_url}/status")
|
stub_request(:get, "#{@vmpooler_url}/status")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 200, :body => @status_response_body, :headers => {})
|
.to_return(:status => 200, :body => @status_response_body, :headers => {})
|
||||||
|
|
||||||
status = Pooler.status(false, @vmpooler_url)
|
status = Pooler.status(false, @vmpooler_url)
|
||||||
|
|
@ -159,7 +158,6 @@ describe Pooler do
|
||||||
|
|
||||||
it 'makes a query about a vm' do
|
it 'makes a query about a vm' do
|
||||||
stub_request(:get, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6")
|
stub_request(:get, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent' => 'Faraday v0.9.2' })
|
|
||||||
.to_return(:status => 200, :body => @query_response_body, :headers => {})
|
.to_return(:status => 200, :body => @query_response_body, :headers => {})
|
||||||
|
|
||||||
query_req = Pooler.query(false, @vmpooler_url, 'fq6qlpjlsskycq6')
|
query_req = Pooler.query(false, @vmpooler_url, 'fq6qlpjlsskycq6')
|
||||||
|
|
@ -174,7 +172,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'makes a snapshot for a single vm' do
|
it 'makes a snapshot for a single vm' do
|
||||||
stub_request(:post, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6/snapshot")
|
stub_request(:post, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6/snapshot")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 200, :body => @snapshot_response_body, :headers => {})
|
.to_return(:status => 200, :body => @snapshot_response_body, :headers => {})
|
||||||
|
|
||||||
snapshot_req = Pooler.snapshot(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile')
|
snapshot_req = Pooler.snapshot(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile')
|
||||||
|
|
@ -189,7 +187,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'makes a request to revert a vm from a snapshot' do
|
it 'makes a request to revert a vm from a snapshot' do
|
||||||
stub_request(:post, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6/snapshot/dAfewKNfaweLKNve")
|
stub_request(:post, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6/snapshot/dAfewKNfaweLKNve")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' })
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' })
|
||||||
.to_return(:status => 200, :body => @revert_response_body, :headers => {})
|
.to_return(:status => 200, :body => @revert_response_body, :headers => {})
|
||||||
|
|
||||||
revert_req = Pooler.revert(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', 'dAfewKNfaweLKNve')
|
revert_req = Pooler.revert(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', 'dAfewKNfaweLKNve')
|
||||||
|
|
@ -213,7 +211,7 @@ describe Pooler do
|
||||||
|
|
||||||
it 'makes a request to extend disk space of a vm' do
|
it 'makes a request to extend disk space of a vm' do
|
||||||
stub_request(:post, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6/disk/12")
|
stub_request(:post, "#{@vmpooler_url}/vm/fq6qlpjlsskycq6/disk/12")
|
||||||
.with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'mytokenfile' }). to_return(:status => 200, :body => @disk_response_body_success, :headers => {})
|
.with(:headers => { 'X-Auth-Token' => 'mytokenfile' }). to_return(:status => 200, :body => @disk_response_body_success, :headers => {})
|
||||||
|
|
||||||
disk_req = Pooler.disk(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', 12)
|
disk_req = Pooler.disk(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', 12)
|
||||||
expect(disk_req['ok']).to be true
|
expect(disk_req['ok']).to be true
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,5 @@ Gem::Specification.new do |s|
|
||||||
|
|
||||||
s.add_dependency 'colorize', '~> 0.8.1'
|
s.add_dependency 'colorize', '~> 0.8.1'
|
||||||
s.add_dependency 'commander', '~> 4.4.3'
|
s.add_dependency 'commander', '~> 4.4.3'
|
||||||
s.add_dependency 'faraday', '~> 0.9.0'
|
s.add_dependency 'faraday', '~> 0.15.0'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue