On 21/07/12 04:12, David Lutterkort wrote:
> Hi Marios,
> 
> On Fri, 2012-07-20 at 19:55 +0300, [email protected] wrote:
>> Initial API tests rewrite - these are intended as 'black box' tests,
>> i.e. to be pointed at a deltacloud API server running somewhere and
>> interacting only with the API and not with deltacloud internals 
>> (as described in more detail http://piratepad.net/deltacloud-testing
>> ). Uses RestClient to do the talking.
> 
> Looks good. I have a whole bunch of comments, which I put in the form of
> patches[1] ;)
> 
> The patch series applies on top of your 2/2 and should just be squashed
> into it. There's a few more changes I'd like to make, but that will have
> to wait until Monday.
> 

many thanks for the comments - great tidying up - including a proper LOL
moment - even after 2.5 yrs of working with ruby I'm still impressed by
monkey patching and editing classes on the fly:

> -    driver = xml_response(res).root[:driver]
> +    driver = res.xml.root[:driver]

/me opens http://rdoc.info/github/archiloque/rest-client/index - looks
for the .xml and .json methods I missed...  until I see

> -def xml_response(xml)
> -  Nokogiri::XML(xml)
> -end

> +module RestClient::Response
> +  def xml
> +    @xml ||= Nokogiri::XML(body)
> +  end
>  
> -def json_response(json)
> -  JSON.parse(json)

> +  def json
> +    @json ||= JSON.parse(body)
> +  end
>  end

:)

marios


> David
> 
> [1] http://people.apache.org/~lutter/patches/tests-rewrite/
> 
> 


Reply via email to