mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
Change useragent for faraday
This commit is contained in:
parent
5f6cd1df1d
commit
53868b9532
2 changed files with 11 additions and 11 deletions
|
|
@ -14,7 +14,7 @@ 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.1'}).
|
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")
|
||||||
|
|
@ -30,7 +30,7 @@ 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.1'}).
|
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)
|
||||||
|
|
@ -45,7 +45,7 @@ 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.1'}).
|
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)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,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.1', 'X-Auth-Token'=>'mytokenfile'}).
|
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 => @retrieve_response_body_single, :headers => {})
|
to_return(:status => 200, :body => @retrieve_response_body_single, :headers => {})
|
||||||
|
|
||||||
vm_hash = {}
|
vm_hash = {}
|
||||||
|
|
@ -59,7 +59,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.1', 'X-Auth-Token'=>'mytokenfile'}).
|
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 => @retrieve_response_body_double, :headers => {})
|
to_return(:status => 200, :body => @retrieve_response_body_double, :headers => {})
|
||||||
|
|
||||||
vm_hash = {}
|
vm_hash = {}
|
||||||
|
|
@ -83,7 +83,7 @@ describe Pooler do
|
||||||
it "modifies the TTL of a vm" do
|
it "modifies the TTL of a vm" do
|
||||||
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.1', 'X-Auth-Token'=>'mytokenfile'}).
|
: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'}).
|
||||||
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', 12, nil)
|
modify_req = Pooler.modify(false, @vmpooler_url, 'fq6qlpjlsskycq6', 'mytokenfile', 12, nil)
|
||||||
|
|
@ -99,7 +99,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.1', 'X-Auth-Token'=>'mytokenfile'}).
|
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'}).
|
||||||
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
|
||||||
|
|
@ -114,7 +114,7 @@ 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.1'}).
|
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)
|
||||||
|
|
@ -138,7 +138,7 @@ 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.1'}).
|
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')
|
||||||
|
|
@ -153,7 +153,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.1', 'X-Auth-Token'=>'mytokenfile'}).
|
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 => @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')
|
||||||
|
|
@ -168,7 +168,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.1', 'X-Auth-Token'=>'mytokenfile'}).
|
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 => @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')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue