On Thu, 2012-08-02 at 18:07 +0300, [email protected] wrote:
> From: marios <[email protected]>
> 
> 
> Signed-off-by: marios <[email protected]>
> ---
>  tests/deltacloud/buckets_test.rb             |  134 
> ++++++++++----------------
>  tests/deltacloud/common_tests_collections.rb |  114 ++++++++++++++++++++++
>  tests/deltacloud/test_setup.rb               |   25 ++++-
>  3 files changed, 187 insertions(+), 86 deletions(-)
>  create mode 100644 tests/deltacloud/common_tests_collections.rb

ACK. (I get a few test failures, but I'll mail about them separately)

> diff --git a/tests/deltacloud/buckets_test.rb 
> b/tests/deltacloud/buckets_test.rb
> index e8732b1..b829b30 100644
> --- a/tests/deltacloud/buckets_test.rb
> +++ b/tests/deltacloud/buckets_test.rb
> @@ -61,19 +61,61 @@ describe 'Deltacloud API buckets collection' do
>      end
>    }

There seem to be a few tests that are duplicated; running

        egrep '^ *it' deltacloud/buckets_test.rb | sort | uniq -c

shows three duplicated tests.


> -  it 'must advertise the buckets collection in API entrypoint' do
> +  #Run the 'common' tests for all collections defined in 
> common_tests_collections.rb
> +  CommonCollectionsTest::run_common_tests_for("buckets")

Nice - I very much like this way of including common tests.

> -    res = get("/").xml
> -    (res/'api/link[@rel=buckets]').wont_be_empty
> +  #Now run the bucket-specific tests:
> +  it 'must have the "size" element defined for each bucket in collection' do
> +    res = get(BUCKETS, :accept => :xml)
> +    (res.xml/'buckets/bucket').each do |r|
> +      (r/'size').wont_be_nil
> +      (r/'size').wont_be_empty
> +    end
>    end

If no buckets are returned, this test will pass; we should check
somewhere that the bucket we created in the prologue actually shows up
under /buckets/bucket

One more general comment: since we have ':accept => :xml' almost
everywhere, we should probably make that the default in the get/put/etc.
helpers.

David


Reply via email to