On Oct 19, 2011, at 7:33 AM, Tomas Sedovic <tsedovic(a)redhat.com> wrote:
On 10/19/2011 01:54 AM, Chris Alfonso wrote:
> Removed image icicles since they're not used.
> The api for target images returns a single provider (may need to revisit)
> ---
> src/spec/controllers/api/builds_controller_spec.rb | 3 +
> src/spec/controllers/api/images_controller_spec.rb | 4 +
> .../api/provider_images_controller_spec.rb | 6 +-
> .../api/target_images_controller_spec.rb | 16 ++--
> src/spec/vcr/cassettes/iwhd_connection.yml | 104 ++++++++++++++++++-
> 5 files changed, 114 insertions(+), 19 deletions(-)
>
> diff --git a/src/spec/controllers/api/builds_controller_spec.rb
b/src/spec/controllers/api/builds_controller_spec.rb
> index d5d35fd..feafaf2 100644
> --- a/src/spec/controllers/api/builds_controller_spec.rb
> +++ b/src/spec/controllers/api/builds_controller_spec.rb
> @@ -124,6 +124,7 @@ describe Api::BuildsController do
> context "when there is NOT wanted build" do
>
> before(:each) do
> + send_and_accept_xml
> Aeolus::Image::Warehouse::ImageBuild.stub(:find).and_return(nil)
> get :show, :id => '10'
> end
> @@ -143,6 +144,7 @@ describe Api::BuildsController do
> describe "#index" do
>
> before(:each) do
> + send_and_accept_xml
> get :index
> end
>
> @@ -155,6 +157,7 @@ describe Api::BuildsController do
> describe "#show" do
>
> before(:each) do
> + send_and_accept_xml
> get :show, :id => '5'
> end
>
> diff --git a/src/spec/controllers/api/images_controller_spec.rb
b/src/spec/controllers/api/images_controller_spec.rb
> index c2c8495..180fc2d 100644
> --- a/src/spec/controllers/api/images_controller_spec.rb
> +++ b/src/spec/controllers/api/images_controller_spec.rb
> @@ -101,6 +101,7 @@ describe Api::ImagesController do
> context "when there is no image" do
>
> before(:each) do
> + send_and_accept_xml
> Aeolus::Image::Warehouse::Image.stub(:all).and_return([])
> get :index
> end
> @@ -141,6 +142,7 @@ describe Api::ImagesController do
> context "when there is NOT wanted image" do
>
> before(:each) do
> + send_and_accept_xml
> Aeolus::Image::Warehouse::Image.stub(:find).and_return(nil)
> get :show, :id => '5'
> end
> @@ -160,6 +162,7 @@ describe Api::ImagesController do
> describe "#index" do
>
> before(:each) do
> + send_and_accept_xml
> get :index
> end
>
> @@ -172,6 +175,7 @@ describe Api::ImagesController do
> describe "#show" do
>
> before(:each) do
> + send_and_accept_xml
> get :show, :id => '5'
> end
>
> diff --git a/src/spec/controllers/api/provider_images_controller_spec.rb
b/src/spec/controllers/api/provider_images_controller_spec.rb
> index 2661c8f..b2f49ac 100644
> --- a/src/spec/controllers/api/provider_images_controller_spec.rb
> +++ b/src/spec/controllers/api/provider_images_controller_spec.rb
> @@ -30,7 +30,7 @@ describe Api::ProviderImagesController do
> :id => '300')
> @pimage = mock(Aeolus::Image::Warehouse::ProviderImage,
> :id => '17',
> - :icicle => '30',
> + :provider_name => 'provider_name',
> :object_type => 'provider_image',
> :target_identifier => '80',
> :target_image => @timage)
> @@ -65,7 +65,6 @@ describe Api::ProviderImagesController do
> resp = Hash.from_xml(response.body)
> @provider_image_collection.each_with_index do |pimage, index|
>
resp['provider_images']['provider_image'][index]['id'].should ==
pimage.id
> -
resp['provider_images']['provider_image'][index]['icicle'].should
== pimage.icicle
>
resp['provider_images']['provider_image'][index]['object_type'].should
== pimage.object_type
>
resp['provider_images']['provider_image'][index]['target_identifier'].should
== pimage.target_identifier
>
resp['provider_images']['provider_image'][index]['target_image']['id'].should
== pimage.target_image.id
> @@ -85,7 +84,6 @@ describe Api::ProviderImagesController do
> it "should have a provider image with corrent attributes" do
> resp = Hash.from_xml(response.body)
>
resp['provider_images']['provider_image']['id'].should ==
@pimage.id
> -
resp['provider_images']['provider_image']['icicle'].should ==
@pimage.icicle
>
resp['provider_images']['provider_image']['object_type'].should ==
@pimage.object_type
>
resp['provider_images']['provider_image']['target_identifier'].should
== @pimage.target_identifier
>
resp['provider_images']['provider_image']['target_image']['id'].should
== @pimage.target_image.id
> @@ -123,7 +121,7 @@ describe Api::ProviderImagesController do
> it "should have a provider image with correct attributes" do
> resp = Hash.from_xml(response.body)
> resp['provider_image']['id'].should == @pimage.id
> - resp['provider_image']['icicle'].should ==
@pimage.icicle
> + resp['provider_image']['provider'].should ==
@pimage.provider_name
> resp['provider_image']['object_type'].should ==
@pimage.object_type
> resp['provider_image']['target_identifier'].should ==
@pimage.target_identifier
>
resp['provider_image']['target_image']['id'].should ==
@pimage.target_image.id
> diff --git a/src/spec/controllers/api/target_images_controller_spec.rb
b/src/spec/controllers/api/target_images_controller_spec.rb
> index 5943111..56d1f4e 100644
> --- a/src/spec/controllers/api/target_images_controller_spec.rb
> +++ b/src/spec/controllers/api/target_images_controller_spec.rb
> @@ -32,7 +32,6 @@ describe Api::TargetImagesController do
> :id => '543')
> @timage = mock(Aeolus::Image::Warehouse::TargetImage,
> :id => '100',
> - :icicle => '321',
> :object_type => 'target_image',
> :template => '12',
> :build => @build,
> @@ -50,6 +49,7 @@ describe Api::TargetImagesController do
> describe "#index" do
> context "when there are 3 target images" do
> before(:each) do
> + send_and_accept_xml
> @timage_collection = [@timage, @timage, @timage]
>
Aeolus::Image::Warehouse::TargetImage.stub(:all).and_return(@timage_collection)
> get :index
> @@ -65,11 +65,10 @@ describe Api::TargetImagesController do
> resp = Hash.from_xml(response.body)
> @timage_collection.each_with_index do |timage, index|
>
resp['target_images']['target_image'][index]['id'].should ==
timage.id
> -
resp['target_images']['target_image'][index]['icicle'].should ==
timage.icicle
>
resp['target_images']['target_image'][index]['object_type'].should
== timage.object_type
>
resp['target_images']['target_image'][index]['template'].should ==
timage.template
>
resp['target_images']['target_image'][index]['build']['id'].should
== timage.build.id
> - pimgs =
resp['target_images']['target_image'][index]['provider_images']
> + pimgs =
resp['target_images']['target_image'][index]['provider_image']
> pimgs['provider_image']['id'].should == @pimage.id
> end
> end
> @@ -77,6 +76,7 @@ describe Api::TargetImagesController do
>
> context "when there is only 1 target images" do
> before(:each) do
> + send_and_accept_xml
> Aeolus::Image::Warehouse::TargetImage.stub(:all).and_return([@timage])
> get :index
> end
> @@ -86,11 +86,10 @@ describe Api::TargetImagesController do
> it "should have a target image with correct attributes" do
> resp = Hash.from_xml(response.body)
>
resp['target_images']['target_image']['id'].should == @timage.id
> -
resp['target_images']['target_image']['icicle'].should ==
@timage.icicle
>
resp['target_images']['target_image']['object_type'].should ==
@timage.object_type
>
resp['target_images']['target_image']['template'].should ==
@timage.template
>
resp['target_images']['target_image']['build']['id'].should
== @timage.build.id
> - pimgs =
resp['target_images']['target_image']['provider_images']
> + pimgs =
resp['target_images']['target_image']['provider_image']
> pimgs['provider_image']['id'].should == @pimage.id
> end
> end
> @@ -113,7 +112,6 @@ describe Api::TargetImagesController do
> describe "#show" do
> context "when there is wanted target image in warehouse" do
> before(:each) do
> -
> Aeolus::Image::Warehouse::TargetImage.stub(:find).and_return(@timage)
> get :show, :id => '100'
> end
> @@ -123,18 +121,17 @@ describe Api::TargetImagesController do
> it "should have a target image with correct attributes" do
> resp = Hash.from_xml(response.body)
> resp['target_image']['id'].should == @timage.id
> - resp['target_image']['icicle'].should == @timage.icicle
> resp['target_image']['object_type'].should ==
@timage.object_type
> resp['target_image']['template'].should ==
@timage.template
> resp['target_image']['build']['id'].should ==
@timage.build.id
> - pimgs = resp['target_image']['provider_images']
> + pimgs = resp['target_image']['provider_image']
> pimgs['provider_image']['id'].should == @pimage.id
> end
> end
>
> context "when there is NOT wanted target image in warehouse" do
> before(:each) do
> -
> + send_and_accept_xml
> Aeolus::Image::Warehouse::TargetImage.stub(:find).and_return(nil)
> end
>
> @@ -178,6 +175,7 @@ describe Api::TargetImagesController do
> describe "#index" do
>
> before(:each) do
> + send_and_accept_xml
> get :index
> end
>
> diff --git a/src/spec/vcr/cassettes/iwhd_connection.yml
b/src/spec/vcr/cassettes/iwhd_connection.yml
> index 91fba47..0b7d7c2 100644
> --- a/src/spec/vcr/cassettes/iwhd_connection.yml
> +++ b/src/spec/vcr/cassettes/iwhd_connection.yml
> @@ -378,7 +378,7 @@
> <object>
> <object_body
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295"/>
> <object_attr_list
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/_attrs"/>
> - <object_attr name="icicle"
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/icicle"/>
> + <object_attr name="provider"
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/provider"/>
> <object_attr name="object_type"
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/object_type"/>
> <object_attr name="target"
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/target"/>
> <object_attr name="target_parameters"
path="http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/target_parameters"/>
> @@ -550,7 +550,7 @@
> <object>
> <object_body
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1"/>
> <object_attr_list
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/_attrs"/>
> - <object_attr name="icicle"
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/icicle"/>
> + <object_attr name="provider"
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/provider"/>
> <object_attr name="object_type"
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/object_type"/>
> <object_attr name="target"
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/target"/>
> <object_attr name="target_parameters"
path="http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/target_parameters"/>
> @@ -937,7 +937,7 @@
> <object_body
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b"/>
> <object_attr_list
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/_attrs"/>
> <object_attr name="build"
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/build"/>
> - <object_attr name="icicle"
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/icicle"/>
> + <object_attr name="provider"
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/provider"/>
> <object_attr name="object_type"
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/object_type"/>
> <object_attr name="target"
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/target"/>
> <object_attr name="target_parameters"
path="http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/target_parameters"/>
> @@ -1133,7 +1133,7 @@
> <object_body
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0"/>
> <object_attr_list
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/_attrs"/>
> <object_attr name="build"
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/build"/>
> - <object_attr name="icicle"
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/icicle"/>
> + <object_attr name="provider"
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/provider"/>
> <object_attr name="object_type"
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/object_type"/>
> <object_attr name="target"
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/target"/>
> <object_attr name="target_parameters"
path="http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/target_parameters"/>
> @@ -1495,7 +1495,7 @@
> <object>
> <object_body
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03"/>
> <object_attr_list
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03/_attrs"/>
> - <object_attr name="icicle"
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03/icicle"/>
> + <object_attr name="provider"
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03/provider"/>
> <object_attr name="object_type"
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03/object_type"/>
> <object_attr name="provider"
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03/provider"/>
> <object_attr name="target_identifier"
path="http://localhost:9090/provider_images/3cdd9f26-b211-454b-89ff-655b0ebbff03/target_identifier"/>
> @@ -1667,7 +1667,7 @@
> <object>
> <object_body
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053"/>
> <object_attr_list
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053/_attrs"/>
> - <object_attr name="icicle"
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053/icicle"/>
> + <object_attr name="provider"
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053/provider"/>
> <object_attr name="object_type"
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053/object_type"/>
> <object_attr name="provider"
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053/provider"/>
> <object_attr name="target_identifier"
path="http://localhost:9090/provider_images/aa57b1ab-f565-4a7a-b054-58ef5af1a053/target_identifier"/>
> @@ -2010,3 +2010,95 @@
> - "0"
> body:
> http_version: "1.1"
> +- !ruby/struct:VCR::HTTPInteraction
> + request: !ruby/struct:VCR::Request
> + method: :get
> + uri:
http://localhost:9090/target_images/1a955a06-ca92-4546-9121-6c35e162f67b/...
> + body:
> + headers:
> + accept:
> + - "*/*; q=0.5, application/xml"
> + accept-encoding:
> + - gzip, deflate
> + content-length:
> + - "0"
> + response: !ruby/struct:VCR::Response
> + status: !ruby/struct:VCR::ResponseStatus
> + code: 404
> + message: Not Found
> + headers:
> + date:
> + - Tue, 18 Oct 2011 23:24:03 GMT
> + content-length:
> + - "0"
> + body:
> + http_version: "1.1"
> +- !ruby/struct:VCR::HTTPInteraction
> + request: !ruby/struct:VCR::Request
> + method: :get
> + uri:
http://localhost:9090/target_images/ce1c6d32-5e26-4feb-9b86-83435a39b1f0/...
> + body:
> + headers:
> + accept:
> + - "*/*; q=0.5, application/xml"
> + accept-encoding:
> + - gzip, deflate
> + content-length:
> + - "0"
> + response: !ruby/struct:VCR::Response
> + status: !ruby/struct:VCR::ResponseStatus
> + code: 404
> + message: Not Found
> + headers:
> + date:
> + - Tue, 18 Oct 2011 23:24:07 GMT
> + content-length:
> + - "0"
> + body:
> + http_version: "1.1"
> +- !ruby/struct:VCR::HTTPInteraction
> + request: !ruby/struct:VCR::Request
> + method: :get
> + uri:
http://localhost:9090/images/34c87aa0-3405-42f8-820e-309054029295/provider
> + body:
> + headers:
> + accept:
> + - "*/*; q=0.5, application/xml"
> + accept-encoding:
> + - gzip, deflate
> + content-length:
> + - "0"
> + response: !ruby/struct:VCR::Response
> + status: !ruby/struct:VCR::ResponseStatus
> + code: 404
> + message: Not Found
> + headers:
> + date:
> + - Tue, 18 Oct 2011 23:32:29 GMT
> + content-length:
> + - "0"
> + body:
> + http_version: "1.1"
> +- !ruby/struct:VCR::HTTPInteraction
> + request: !ruby/struct:VCR::Request
> + method: :get
> + uri:
http://localhost:9090/images/ef6fd2bb-50d4-4f53-ae92-a68b01f82cf1/provider
> + body:
> + headers:
> + accept:
> + - "*/*; q=0.5, application/xml"
> + accept-encoding:
> + - gzip, deflate
> + content-length:
> + - "0"
> + response: !ruby/struct:VCR::Response
> + status: !ruby/struct:VCR::ResponseStatus
> + code: 404
> + message: Not Found
> + headers:
> + date:
> + - Tue, 18 Oct 2011 23:35:08 GMT
> + content-length:
> + - "0"
> + body:
> + http_version: "1.1"
Hey Chris,
I didn't notice that the patch was already pushed -- I didn't see any
ACK email -- so I reviewed it.
Thanks for reviewing it, I pushed it because our
tests were failing, mainly because I ack'd a patch earlier that broke the tests.
I have a couple of notes that are somewhat independent on the code itself:
1. please add project name to the patch subject prefix. Something like:
That's my bad, it was late and I forgot. I am SO sorry :P
[PATCH Conductor] Fixed up failing api rspec tests.
There are patches from multiple projects floating around and it's not
always immediately obvious for which project any given patch is.
2. applying the patch gives me a slew of whitespace warnings. These are
in the VCR recording so it's probably okay.
I've been framed! The white
space was already in the file when I got it. I used the FixWhitespace VIM plugin to try to
fix up the cassette. The git hook is a great idea, I'll set that up. I'm innocent
I tell you..
But just in case you're not aware of this: we don't want to have
trailing whitespace in our codebase. There is a git hook that will
prevent you from committing a code that has trailing whitespace in it.
If you haven't, you can enable it thusly:
$ cd conductor/.git/hooks
$ cp pre-commit.sample pre-commit
Thanks & take care,
Thomas
--
No trees were killed to send this message, but a large number of
electrons were terribly inconvenienced.
_______________________________________________
aeolus-devel mailing list
aeolus-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/aeolus-devel