You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/07/26 16:20:32 UTC

[PATCH core 1/3] EC2: Initial unit tests for EC2 frontend

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/tests/ec2/common.rb            |   19 +++++++
 server/tests/ec2/query_parser_test.rb |   97 +++++++++++++++++++++++++++++++++
 server/tests/ec2/server_test.rb       |   44 +++++++++++++++
 3 files changed, 160 insertions(+)
 create mode 100644 server/tests/ec2/common.rb
 create mode 100644 server/tests/ec2/query_parser_test.rb
 create mode 100644 server/tests/ec2/server_test.rb

diff --git a/server/tests/ec2/common.rb b/server/tests/ec2/common.rb
new file mode 100644
index 0000000..21787c1
--- /dev/null
+++ b/server/tests/ec2/common.rb
@@ -0,0 +1,19 @@
+require_relative File.join('..', '..', 'lib', 'deltacloud_rack.rb')
+
+# Set the default driver used for server API tests
+#
+ENV['API_DRIVER'] = 'mock'
+
+# Setup Deltacloud::API Sinatra instance
+#
+unless Deltacloud::config[:ec2]
+  Deltacloud::configure(:ec2) do |server|
+    server.root_url '/'
+    server.version '2012-04-01'
+    server.klass 'Deltacloud::EC2::API'
+    server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
+  end
+  Deltacloud.require_frontend! :ec2
+end
+
+def root_url; Deltacloud.config[:ec2].root_url; end
diff --git a/server/tests/ec2/query_parser_test.rb b/server/tests/ec2/query_parser_test.rb
new file mode 100644
index 0000000..761e5bc
--- /dev/null
+++ b/server/tests/ec2/query_parser_test.rb
@@ -0,0 +1,97 @@
+require 'minitest/autorun'
+
+require_relative 'common.rb'
+require_relative File.join('..', '..', 'lib', 'deltacloud', 'api.rb')
+
+describe Deltacloud::EC2 do
+
+  describe Deltacloud::EC2::ActionHandler do
+
+    before do
+      @handler = Deltacloud::EC2::ActionHandler
+    end
+
+    it 'provides access to mappings' do
+      @handler.mappings.wont_be_nil
+      @handler.mappings.must_be_kind_of Hash
+    end
+
+  end
+
+  describe Deltacloud::EC2::QueryParser do
+
+    before do
+      @parser = Deltacloud::EC2::QueryParser
+    end
+
+    it 'parse request parameters and assign the action' do
+      result = @parser.parse({'Action' => 'DescribeAvailabilityZones', 'ZoneName.1' => 'us'}, '1')
+      result.wont_be_nil
+      result.must_be_kind_of Deltacloud::EC2::ActionHandler
+      result.action.wont_be_nil
+      result.action.must_be_kind_of @parser
+      result.action.action.must_equal :describe_availability_zones
+      result.action.request_id.must_equal '1'
+      result.action.parameters.wont_be_nil
+      result.action.parameters.must_be_kind_of Hash
+      result.action.parameters['ZoneName.1'].must_equal 'us'
+    end
+
+    it 'must provide verification for actions' do
+      result = @parser.parse({'Action' => 'DescribeAvailabilityZones', 'ZoneName.1' => 'us'}, '1')
+      result.wont_be_nil
+      result.must_be_kind_of Deltacloud::EC2::ActionHandler
+      result.action.wont_be_nil
+      result.action.must_be_kind_of @parser
+      result.action.valid_actions.wont_be_nil
+      result.action.valid_actions.must_include :describe_availability_zones
+      result.action.valid_action?.must_equal true
+    end
+
+    it 'must provide the Deltacloud method for EC2 action' do
+      result = @parser.parse({'Action' => 'DescribeAvailabilityZones', 'ZoneName.1' => 'us'}, '1')
+      result.wont_be_nil
+      result.must_be_kind_of Deltacloud::EC2::ActionHandler
+      result.deltacloud_method.must_equal :realms
+      result.deltacloud_method_params[:id].wont_be_nil
+      result.deltacloud_method_params[:id].must_equal 'us'
+    end
+
+  end
+
+  describe Deltacloud::EC2::ResultParser do
+
+    before do
+      @parser = Deltacloud::EC2::QueryParser
+      @driver = Deltacloud::new(:mock, :user => 'mockuser', :password => 'mockpassword')
+      def app; Deltacloud::EC2::API; end
+    end
+
+    it 'must perform the EC2 action on Deltacloud driver' do
+      result = @parser.parse({'Action' => 'DescribeAvailabilityZones', 'ZoneName.1' => 'us'}, '1')
+      result.wont_be_nil
+      result.must_be_kind_of Deltacloud::EC2::ActionHandler
+      result.action.wont_be_nil
+      result.action.must_be_kind_of @parser
+      result.must_respond_to :'perform!'
+      realms = result.perform!(@driver.credentials, @driver.backend)
+      realms.wont_be_empty
+      realms.first.must_be_kind_of Realm
+      realms.first.id.must_equal 'us'
+    end
+
+    it 'must parse the result of EC2 action to EC2 formatted XML' do
+      result = @parser.parse({'Action' => 'DescribeAvailabilityZones', 'ZoneName.1' => 'us'}, '1')
+      result.wont_be_nil
+      result.must_be_kind_of Deltacloud::EC2::ActionHandler
+      result.action.wont_be_nil
+      result.action.must_be_kind_of @parser
+      result.must_respond_to :'perform!'
+      result.perform!(@driver.credentials, @driver.backend)
+      result = Nokogiri::XML(result.to_xml(app))
+      result.root.name.must_equal 'DescribeAvailabilityZonesResponse'
+    end
+
+  end
+
+end
diff --git a/server/tests/ec2/server_test.rb b/server/tests/ec2/server_test.rb
new file mode 100644
index 0000000..cca030b
--- /dev/null
+++ b/server/tests/ec2/server_test.rb
@@ -0,0 +1,44 @@
+require 'minitest/autorun'
+
+require_relative 'common.rb'
+
+describe Deltacloud::EC2::API do
+
+  before do
+    def app; Deltacloud::EC2::API; end
+  end
+
+  it 'has the config set property' do
+    Deltacloud::config[:ec2].must_be_kind_of Deltacloud::Server
+    root_url.must_equal Deltacloud[:ec2].root_url
+  end
+
+  it 'must do a redirection when no Action parameter' do
+    get root_url
+    status.must_equal 301
+    headers['Location'].must_equal 'http://example.org/'
+  end
+
+  it 'must set the Connection header to close' do
+    get root_url
+    headers['Connection'].must_equal 'close'
+  end
+
+  it 'must advertise current API version in response headers' do
+    get root_url
+    headers['Server'].must_equal 'Apache-Deltacloud-EC2/2012-04-01'
+  end
+
+  it 'must return EC2 exception when unknown action' do
+    get root_url + '?Action=UnknownActionTest'
+    xml.root.name.must_equal 'Response'
+    (xml/'Response/Errors/Code').first.text.strip.must_equal 'InvalidAction'
+  end
+
+  it 'must return EC2 exception when authentication failed' do
+    authorize 'unknownuser', 'password'
+    get root_url + '?Action=DescribeAvailabilityZones'
+    status.must_equal 401
+  end
+
+end
-- 
1.7.10.2


Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes

Posted by Michal Fojtik <mf...@redhat.com>.
Hi,

Of course I forgot to attach the tar :-)


Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes

Posted by Ronelle Landy <rl...@redhat.com>.
> 
> Hi,
> 
> I re-recorded all fixtures for EC2 using Ruby 1.8:
> 
> firefly ~/code/core/server $ rvm list
> 
> => ruby-1.8.7-p370 [ i686 ]
>  * ruby-1.9.3-p125 [ x86_64 ]
> 
> firefly ~/code/core/server $ rake test:drivers:ec2
> Run options: --seed 24923
> 
> # Running tests:
> 
> /Users/mfojtik/.rvm/gems/ruby-1.8.7-p370/gems/aws-2.5.6/lib/awsbase/awsbase.rb:66:
> warning: already initialized constant AMAZON_PROBLEMS
> /Users/mfojtik/.rvm/gems/ruby-1.8.7-p370/gems/aws-2.5.6/lib/awsbase/awsbase.rb:86:
> warning: already initialized constant DEFAULT_SIGNATURE_VERSION
> ....................
> 
> Finished tests in 0.000000s, inf tests/s, inf assertions/s.
> 
> 20 tests, 159 assertions, 0 failures, 0 errors, 0 skips
> 
ACK - EC2 test work for QE ... 

Finished tests in 0.000000s, inf tests/s, inf assertions/s.

20 tests, 159 assertions, 0 failures, 0 errors, 0 skips

> 
> Now both Ruby 1.9 and 1.8 works for me without VCR failures.
> 
> Can you try a new patch set I attached on Fedora? Also attaching
> my bundler lockfile, just for sure:
> 
> http://omicron.mifo.sk/patches.tar.gz
> http://omicron.mifo.sk/Gemfile.lock
> 
>  -- Michal
> 
> 
> Michal Fojtik
> http://deltacloud.org
> mfojtik@redhat.com
> 
> 
> 
> On Jul 27, 2012, at 11:19 PM, Ronelle Landy <rl...@redhat.com>
> wrote:
> 
> >> From: "David Lutterkort" <lu...@redhat.com>
> >> To: dev@deltacloud.apache.org
> >> Sent: Friday, July 27, 2012 5:04:06 PM
> >> Subject: Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8
> >> fixes
> >> 
> >> On Fri, 2012-07-27 at 14:28 +0200, Michal Fojtik wrote:
> >>> Hi,
> >>> 
> >>> The problem under 1.8 seems missing 'require "rubygems"' on top
> >>> of 'test_helper.rb'. Adding that solved this problem.
> >>> 
> >>> I applied David patches on top of my patches + added the EC2
> >>> front-end
> >>> patches.
> >>> 
> >>> Everything seems to play nicely together though now it is more
> >>> than
> >>> 20
> >>> patches ;-) (I know I promised not send patch-bombs anymore).
> >>> 
> >>> To make it more easy to review, I compressed them into tar
> >>> archive
> >>> you
> >>> found attached to this email.
> >>> 
> >>> David: Can we just commit what we have now, even it is not ideal
> >>> in
> >>> terms of
> >>> recording credentials and then fix it later?
> >> 
> >> I'd love to commit the patches, but for me 'rake test' fails with
> >> a
> >> whole bunch of VCR failures in the EC2 tests. I've uploaded a log
> >> of
> >> 'rake test'[1] and attach my Gemfile.lock
> > 
> > I also tried the tests on RHEL 6.2 box (ruby 1.8.7) using >> bundle
> > && bundle exec rake test
> > I see the same ec2 test failures.
> > 
> >> 
> >> These patches get an ACK from me if rerecording the VCR data does
> >> indeed
> >> fix the failures - if that's all you need to do, feel free to
> >> commit
> >> them.
> >> 
> >> David
> >> 
> >> [1] http://people.apache.org/~lutter/rake-test.txt
> >> 
> >> 
> >> 
> >> 
> 
> 

Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes

Posted by Michal Fojtik <mf...@redhat.com>.
Hi,

I re-recorded all fixtures for EC2 using Ruby 1.8:

firefly ~/code/core/server $ rvm list

=> ruby-1.8.7-p370 [ i686 ]
 * ruby-1.9.3-p125 [ x86_64 ]

firefly ~/code/core/server $ rake test:drivers:ec2
Run options: --seed 24923

# Running tests:

/Users/mfojtik/.rvm/gems/ruby-1.8.7-p370/gems/aws-2.5.6/lib/awsbase/awsbase.rb:66: warning: already initialized constant AMAZON_PROBLEMS
/Users/mfojtik/.rvm/gems/ruby-1.8.7-p370/gems/aws-2.5.6/lib/awsbase/awsbase.rb:86: warning: already initialized constant DEFAULT_SIGNATURE_VERSION
....................

Finished tests in 0.000000s, inf tests/s, inf assertions/s.

20 tests, 159 assertions, 0 failures, 0 errors, 0 skips


Now both Ruby 1.9 and 1.8 works for me without VCR failures.

Can you try a new patch set I attached on Fedora? Also attaching
my bundler lockfile, just for sure:

http://omicron.mifo.sk/patches.tar.gz
http://omicron.mifo.sk/Gemfile.lock

 -- Michal


Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com



On Jul 27, 2012, at 11:19 PM, Ronelle Landy <rl...@redhat.com> wrote:

>> From: "David Lutterkort" <lu...@redhat.com>
>> To: dev@deltacloud.apache.org
>> Sent: Friday, July 27, 2012 5:04:06 PM
>> Subject: Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes
>> 
>> On Fri, 2012-07-27 at 14:28 +0200, Michal Fojtik wrote:
>>> Hi,
>>> 
>>> The problem under 1.8 seems missing 'require "rubygems"' on top
>>> of 'test_helper.rb'. Adding that solved this problem.
>>> 
>>> I applied David patches on top of my patches + added the EC2
>>> front-end
>>> patches.
>>> 
>>> Everything seems to play nicely together though now it is more than
>>> 20
>>> patches ;-) (I know I promised not send patch-bombs anymore).
>>> 
>>> To make it more easy to review, I compressed them into tar archive
>>> you
>>> found attached to this email.
>>> 
>>> David: Can we just commit what we have now, even it is not ideal in
>>> terms of
>>> recording credentials and then fix it later?
>> 
>> I'd love to commit the patches, but for me 'rake test' fails with a
>> whole bunch of VCR failures in the EC2 tests. I've uploaded a log of
>> 'rake test'[1] and attach my Gemfile.lock
> 
> I also tried the tests on RHEL 6.2 box (ruby 1.8.7) using >> bundle && bundle exec rake test
> I see the same ec2 test failures.
> 
>> 
>> These patches get an ACK from me if rerecording the VCR data does
>> indeed
>> fix the failures - if that's all you need to do, feel free to commit
>> them.
>> 
>> David
>> 
>> [1] http://people.apache.org/~lutter/rake-test.txt
>> 
>> 
>> 
>> 


Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes

Posted by Ronelle Landy <rl...@redhat.com>.
> From: "David Lutterkort" <lu...@redhat.com>
> To: dev@deltacloud.apache.org
> Sent: Friday, July 27, 2012 5:04:06 PM
> Subject: Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes
> 
> On Fri, 2012-07-27 at 14:28 +0200, Michal Fojtik wrote:
> > Hi,
> > 
> > The problem under 1.8 seems missing 'require "rubygems"' on top
> > of 'test_helper.rb'. Adding that solved this problem.
> > 
> > I applied David patches on top of my patches + added the EC2
> > front-end
> > patches.
> > 
> > Everything seems to play nicely together though now it is more than
> > 20
> > patches ;-) (I know I promised not send patch-bombs anymore).
> > 
> > To make it more easy to review, I compressed them into tar archive
> > you
> > found attached to this email.
> > 
> > David: Can we just commit what we have now, even it is not ideal in
> > terms of
> > recording credentials and then fix it later?
> 
> I'd love to commit the patches, but for me 'rake test' fails with a
> whole bunch of VCR failures in the EC2 tests. I've uploaded a log of
> 'rake test'[1] and attach my Gemfile.lock

I also tried the tests on RHEL 6.2 box (ruby 1.8.7) using >> bundle && bundle exec rake test
I see the same ec2 test failures.

> 
> These patches get an ACK from me if rerecording the VCR data does
> indeed
> fix the failures - if that's all you need to do, feel free to commit
> them.
> 
> David
> 
> [1] http://people.apache.org/~lutter/rake-test.txt
> 
> 
> 
> 

Re: RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes

Posted by David Lutterkort <lu...@redhat.com>.
On Fri, 2012-07-27 at 14:28 +0200, Michal Fojtik wrote:
> Hi,
> 
> The problem under 1.8 seems missing 'require "rubygems"' on top
> of 'test_helper.rb'. Adding that solved this problem.
> 
> I applied David patches on top of my patches + added the EC2 front-end
> patches.
> 
> Everything seems to play nicely together though now it is more than 20
> patches ;-) (I know I promised not send patch-bombs anymore).
> 
> To make it more easy to review, I compressed them into tar archive you
> found attached to this email.
> 
> David: Can we just commit what we have now, even it is not ideal in terms of
> recording credentials and then fix it later? 

I'd love to commit the patches, but for me 'rake test' fails with a
whole bunch of VCR failures in the EC2 tests. I've uploaded a log of
'rake test'[1] and attach my Gemfile.lock

These patches get an ACK from me if rerecording the VCR data does indeed
fix the failures - if that's all you need to do, feel free to commit
them.

David

[1] http://people.apache.org/~lutter/rake-test.txt




RHEV-M driver unit tests, EC2 fronted tests and 1.8 fixes

Posted by Michal Fojtik <mf...@redhat.com>.
Hi,

The problem under 1.8 seems missing 'require "rubygems"' on top
of 'test_helper.rb'. Adding that solved this problem.

I applied David patches on top of my patches + added the EC2 front-end
patches.

Everything seems to play nicely together though now it is more than 20
patches ;-) (I know I promised not send patch-bombs anymore).

To make it more easy to review, I compressed them into tar archive you
found attached to this email.

David: Can we just commit what we have now, even it is not ideal in terms of
recording credentials and then fix it later? 

  -- Michal

Michal Fojtik
http://deltacloud.org
mfojtik@redhat.com



On Jul 27, 2012, at 12:55 AM, David Lutterkort wrote:

> On Thu, 2012-07-26 at 16:20 +0200, mfojtik@redhat.com wrote:
>> From: Michal Fojtik <mf...@redhat.com>
>> 
>> 
>> Signed-off-by: Michal fojtik <mf...@redhat.com>
>> ---
>> server/tests/ec2/common.rb            |   19 +++++++
>> server/tests/ec2/query_parser_test.rb |   97 +++++++++++++++++++++++++++++++++
>> server/tests/ec2/server_test.rb       |   44 +++++++++++++++
>> 3 files changed, 160 insertions(+)
>> create mode 100644 server/tests/ec2/common.rb
>> create mode 100644 server/tests/ec2/query_parser_test.rb
>> create mode 100644 server/tests/ec2/server_test.rb
> 
> Both 'rake test' and 'bundle exec rake test' give me
> 
>        ./tests/test_helper.rb:2:in `require': no such file to load -- rack/test (LoadError)
>                from ./tests/test_helper.rb:2
>        rake aborted!
>        Command failed with status (1): [/usr/bin/ruby -I"lib" -r./tests/test_helpe...]
> 
>        Tasks: TOP => test
>        (See full trace by running task with --trace)
> 
> 
> David
> 
> 


Re: [PATCH core 1/3] EC2: Initial unit tests for EC2 frontend

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2012-07-26 at 16:20 +0200, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/tests/ec2/common.rb            |   19 +++++++
>  server/tests/ec2/query_parser_test.rb |   97 +++++++++++++++++++++++++++++++++
>  server/tests/ec2/server_test.rb       |   44 +++++++++++++++
>  3 files changed, 160 insertions(+)
>  create mode 100644 server/tests/ec2/common.rb
>  create mode 100644 server/tests/ec2/query_parser_test.rb
>  create mode 100644 server/tests/ec2/server_test.rb

Both 'rake test' and 'bundle exec rake test' give me

        ./tests/test_helper.rb:2:in `require': no such file to load -- rack/test (LoadError)
                from ./tests/test_helper.rb:2
        rake aborted!
        Command failed with status (1): [/usr/bin/ruby -I"lib" -r./tests/test_helpe...]
        
        Tasks: TOP => test
        (See full trace by running task with --trace)
        

David



[PATCH core 2/3] EC2: Minor improvements to EC2 frontned parser

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

* ActionHandler now advertise mappings using 'mappings' method
* deltacloud_method_params now survive repetetive calls

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/ec2/query_parser.rb |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/server/lib/ec2/query_parser.rb b/server/lib/ec2/query_parser.rb
index 8050119..2098d24 100644
--- a/server/lib/ec2/query_parser.rb
+++ b/server/lib/ec2/query_parser.rb
@@ -31,6 +31,10 @@ module Deltacloud::EC2
       :terminate_instances => { :method => :destroy_instance, :params => { 'InstanceId.1' => :id }},
     }
 
+    def self.mappings
+      MAPPINGS
+    end
+
     attr_reader :action
 
     def initialize(action)
@@ -38,12 +42,13 @@ module Deltacloud::EC2
     end
 
     def deltacloud_method
-      MAPPINGS[action.action][:method]
+      self.class.mappings[action.action][:method]
     end
 
     def deltacloud_method_params
-      MAPPINGS[action.action][:params].inject({}) do |result, p|
-        result[p.last] = action.parameters.delete(p.first)
+      parameters = action.parameters.dup
+      self.class.mappings[action.action][:params].inject({}) do |result, p|
+        result[p.last] = parameters.delete(p.first)
         result.delete_if { |k,v| v.nil? }
       end
     end
@@ -137,7 +142,7 @@ module Deltacloud::EC2
     end
 
     def valid_actions
-      ActionHandler::MAPPINGS.keys
+      ActionHandler::mappings.keys
     end
 
     def valid_action?
-- 
1.7.10.2


[PATCH core 3/3] Core: Moved rack-test helpers to test_helper

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>

The rack-test helpers are now shared with EC2
frontend tests. To avoid code duplication test_helper
will be better place for them.

Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/tests/deltacloud/common.rb |   16 ++--------------
 server/tests/test_helper.rb       |   11 +++++++++++
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/server/tests/deltacloud/common.rb b/server/tests/deltacloud/common.rb
index 728ad57..d2f59e5 100644
--- a/server/tests/deltacloud/common.rb
+++ b/server/tests/deltacloud/common.rb
@@ -1,22 +1,8 @@
-require 'logger'
-require 'rack/test'
-require 'nokogiri'
-
 require_relative File.join('..', '..', 'lib', 'deltacloud_rack.rb')
 
-include Rack::Test::Methods
-
-def status; last_response.status; end
-def headers; last_response.headers; end
-def response_body; last_response.body; end
-def xml; Nokogiri::XML(response_body); end
-def root_url; Deltacloud.config[:deltacloud].root_url; end
-def formats; [ 'application/xml', 'application/json', 'text/html' ]; end
-
 # Set the default driver used for server API tests
 #
 ENV['API_DRIVER'] = 'mock'
-ENV['RACK_ENV']   = 'test'
 
 # Setup Deltacloud::API Sinatra instance
 #
@@ -30,3 +16,5 @@ unless Deltacloud::config[:deltacloud]
 
   Deltacloud.require_frontend!
 end
+
+def root_url; Deltacloud.config[:deltacloud].root_url; end
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 5aed571..72e26d2 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -1,3 +1,6 @@
+require 'logger'
+require 'rack/test'
+require 'nokogiri'
 require 'pp'
 
 ENV['RACK_ENV'] = 'test'
@@ -30,3 +33,11 @@ unless Kernel.respond_to?(:require_relative)
     end
   end
 end
+
+include Rack::Test::Methods
+
+def status; last_response.status; end
+def headers; last_response.headers; end
+def response_body; last_response.body; end
+def xml; Nokogiri::XML(response_body); end
+def formats; [ 'application/xml', 'application/json', 'text/html' ]; end
-- 
1.7.10.2