Simply the request stubs, add comments
Remove the stubs that are not required, making everything easier to understand
This commit is contained in:
parent
c0d88f1da6
commit
df65190df8
@ -12,18 +12,18 @@ describe "S3 provider" do
|
|||||||
before do
|
before do
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
||||||
to_return(status: 200, headers: { etag: '"0815etag"' })
|
to_return(status: 200, headers: { etag: '"0815etag"' })
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
# Write new content with an If-Match header (a new Etag is returned)
|
||||||
with(body: "si").
|
|
||||||
to_return(status: 200, headers: { etag: '"0815etag"' })
|
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
||||||
with(body: "aye").
|
with(body: "aye").
|
||||||
to_return(status: 200, headers: { etag: '"0915etag"' })
|
to_return(status: 200, headers: { etag: '"0915etag"' })
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
stub_request(:head, "#{container_url_for("phil")}/food/aguacate").
|
||||||
with(body: "deliciosa").
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
to_return(status: 200, headers: { etag: '"0815etag"' })
|
stub_request(:get, "#{container_url_for("phil")}/food/aguacate").
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
to_return(status: 200, body: "rootbody", headers: { etag: '"0817etag"', content_type: "text/plain; charset=utf-8" })
|
||||||
with(body: "muy deliciosa").
|
stub_request(:delete, "#{container_url_for("phil")}/food/aguacate").
|
||||||
to_return(status: 200, headers: { etag: '"0815etag"' })
|
to_return(status: 200, headers: { etag: '"0815etag"' })
|
||||||
|
|
||||||
|
# PUT requests authorized updates the metadata object in redis when it changes
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/banano").
|
stub_request(:put, "#{container_url_for("phil")}/food/banano").
|
||||||
with(body: "si").
|
with(body: "si").
|
||||||
to_return(status: 200, headers: { etag: '"0815etag"' })
|
to_return(status: 200, headers: { etag: '"0815etag"' })
|
||||||
@ -32,28 +32,28 @@ describe "S3 provider" do
|
|||||||
to_return(status: 200, headers: { etag: '"0817etag"' })
|
to_return(status: 200, headers: { etag: '"0817etag"' })
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/banano").
|
stub_request(:head, "#{container_url_for("phil")}/food/banano").
|
||||||
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:20 GMT" })
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:20 GMT" })
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/aguacate").
|
|
||||||
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
||||||
stub_request(:delete, "#{container_url_for("phil")}/food/aguacate").
|
|
||||||
to_return(status: 200, headers: { etag: '"0815etag"' })
|
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/camaron").
|
stub_request(:put, "#{container_url_for("phil")}/food/camaron").
|
||||||
to_return(status: 200, headers: { etag: '"0816etag"' })
|
to_return(status: 200, headers: { etag: '"0816etag"' })
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/camaron").
|
stub_request(:head, "#{container_url_for("phil")}/food/camaron").
|
||||||
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:delete, "#{container_url_for("phil")}/food/camaron").
|
stub_request(:delete, "#{container_url_for("phil")}/food/camaron").
|
||||||
to_return(status: 200, headers: { etag: '"0816etag"' })
|
to_return(status: 200, headers: { etag: '"0816etag"' })
|
||||||
|
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/desayunos/bolon").
|
stub_request(:put, "#{container_url_for("phil")}/food/desayunos/bolon").
|
||||||
to_return(status: 200, headers: { etag: '"0817etag"' })
|
to_return(status: 200, headers: { etag: '"0817etag"' })
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/desayunos/bolon").
|
stub_request(:head, "#{container_url_for("phil")}/food/desayunos/bolon").
|
||||||
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:delete, "#{container_url_for("phil")}/food/desayunos/bolon").
|
stub_request(:delete, "#{container_url_for("phil")}/food/desayunos/bolon").
|
||||||
to_return(status: 200, headers: { etag: '"0817etag"' })
|
to_return(status: 200, headers: { etag: '"0817etag"' })
|
||||||
stub_request(:get, "#{container_url_for("phil")}/food/aguacate").
|
|
||||||
to_return(status: 200, body: "rootbody", headers: { etag: '"0817etag"', content_type: "text/plain; charset=utf-8" })
|
# objects in root dir
|
||||||
stub_request(:put, "#{container_url_for("phil")}/bamboo.txt").
|
stub_request(:put, "#{container_url_for("phil")}/bamboo.txt").
|
||||||
to_return(status: 200, headers: { etag: '"0818etag"' })
|
to_return(status: 200, headers: { etag: '"0818etag"' })
|
||||||
stub_request(:head, "#{container_url_for("phil")}/bamboo.txt").
|
stub_request(:head, "#{container_url_for("phil")}/bamboo.txt").
|
||||||
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
|
|
||||||
|
# 404
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/steak").
|
stub_request(:head, "#{container_url_for("phil")}/food/steak").
|
||||||
to_return(status: 404)
|
to_return(status: 404)
|
||||||
stub_request(:get, "#{container_url_for("phil")}/food/steak").
|
stub_request(:get, "#{container_url_for("phil")}/food/steak").
|
||||||
|
@ -12,40 +12,40 @@ describe "Swift provider" do
|
|||||||
before do
|
before do
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
||||||
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
# Write new content with an If-Match header (a new Etag is returned)
|
||||||
with(body: "si").
|
|
||||||
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
||||||
with(body: "aye").
|
with(body: "aye").
|
||||||
to_return(status: 200, headers: { etag: "0915etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0915etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
stub_request(:head, "#{container_url_for("phil")}/food/aguacate").
|
||||||
with(body: "deliciosa").
|
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
stub_request(:get, "#{container_url_for("phil")}/food/aguacate").
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/aguacate").
|
to_return(status: 200, body: "rootbody", headers: { etag: "0817etag", content_type: "text/plain; charset=utf-8" })
|
||||||
with(body: "muy deliciosa").
|
stub_request(:delete, "#{container_url_for("phil")}/food/aguacate").
|
||||||
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0815etag" })
|
||||||
|
|
||||||
|
# PUT requests authorized updates the metadata object in redis when it changes
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/banano").
|
stub_request(:put, "#{container_url_for("phil")}/food/banano").
|
||||||
with(body: "si").
|
with(body: "si").
|
||||||
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0815etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/banano").
|
stub_request(:put, "#{container_url_for("phil")}/food/banano").
|
||||||
with(body: "oh, no").
|
with(body: "oh, no").
|
||||||
to_return(status: 200, headers: { etag: "0817etag", last_modified: "Fri, 04 Mar 2016 12:20:20 GMT" })
|
to_return(status: 200, headers: { etag: "0817etag", last_modified: "Fri, 04 Mar 2016 12:20:20 GMT" })
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/aguacate").
|
|
||||||
to_return(status: 200, headers: { last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
|
||||||
stub_request(:delete, "#{container_url_for("phil")}/food/aguacate").
|
|
||||||
to_return(status: 200, headers: { etag: "0815etag" })
|
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/camaron").
|
stub_request(:put, "#{container_url_for("phil")}/food/camaron").
|
||||||
to_return(status: 200, headers: { etag: "0816etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0816etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:delete, "#{container_url_for("phil")}/food/camaron").
|
stub_request(:delete, "#{container_url_for("phil")}/food/camaron").
|
||||||
to_return(status: 200, headers: { etag: "0816etag" })
|
to_return(status: 200, headers: { etag: "0816etag" })
|
||||||
|
|
||||||
stub_request(:put, "#{container_url_for("phil")}/food/desayunos/bolon").
|
stub_request(:put, "#{container_url_for("phil")}/food/desayunos/bolon").
|
||||||
to_return(status: 200, headers: { etag: "0817etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0817etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
stub_request(:delete, "#{container_url_for("phil")}/food/desayunos/bolon").
|
stub_request(:delete, "#{container_url_for("phil")}/food/desayunos/bolon").
|
||||||
to_return(status: 200, headers: { etag: "0817etag" })
|
to_return(status: 200, headers: { etag: "0817etag" })
|
||||||
stub_request(:get, "#{container_url_for("phil")}/food/aguacate").
|
|
||||||
to_return(status: 200, body: "rootbody", headers: { etag: "0817etag", content_type: "text/plain; charset=utf-8" })
|
# objects in root dir
|
||||||
stub_request(:put, "#{container_url_for("phil")}/bamboo.txt").
|
stub_request(:put, "#{container_url_for("phil")}/bamboo.txt").
|
||||||
to_return(status: 200, headers: { etag: "0818etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
to_return(status: 200, headers: { etag: "0818etag", last_modified: "Fri, 04 Mar 2016 12:20:18 GMT" })
|
||||||
|
|
||||||
|
# 404
|
||||||
stub_request(:head, "#{container_url_for("phil")}/food/steak").
|
stub_request(:head, "#{container_url_for("phil")}/food/steak").
|
||||||
to_return(status: 404)
|
to_return(status: 404)
|
||||||
stub_request(:get, "#{container_url_for("phil")}/food/steak").
|
stub_request(:get, "#{container_url_for("phil")}/food/steak").
|
||||||
|
Loading…
x
Reference in New Issue
Block a user