Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 61BCFD5B0 for ; Thu, 6 Dec 2012 02:44:17 +0000 (UTC) Received: (qmail 76792 invoked by uid 500); 6 Dec 2012 02:44:17 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 76766 invoked by uid 500); 6 Dec 2012 02:44:17 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 76754 invoked by uid 99); 6 Dec 2012 02:44:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2012 02:44:17 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lutter@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2012 02:44:10 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qB62hm2N022050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Dec 2012 21:43:48 -0500 Received: from melon.com (ovpn-116-21.sin2.redhat.com [10.67.116.21]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qB62h8CN028148 for ; Wed, 5 Dec 2012 21:43:47 -0500 From: lutter@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH 11/13] * tests/cimi/test_helper.rb (retrieve): accomodate responses w/o body Date: Wed, 5 Dec 2012 18:42:55 -0800 Message-Id: <1354761777-20801-12-git-send-email-lutter@redhat.com> In-Reply-To: <1354761777-20801-1-git-send-email-lutter@redhat.com> References: <1354761777-20801-1-git-send-email-lutter@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org From: David Lutterkort --- tests/cimi/test_helper.rb | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb index b19dd9e..9df8000 100644 --- a/tests/cimi/test_helper.rb +++ b/tests/cimi/test_helper.rb @@ -163,7 +163,7 @@ module CIMI::Test::Methods resource = resp.xml.root.name end else - raise "Unexpected content type #{response.content_type}" + raise "Unexpected content type #{resp.content_type}" end CIMI::Model::const_get(resource) end @@ -380,6 +380,8 @@ end class CIMI::Test::Spec < MiniTest::Spec include CIMI::Test::Methods + attr_reader :format, :content_type + CONTENT_TYPES = { :xml => "application/xml", :json => "application/json" } @@ -460,9 +462,11 @@ class CIMI::Test::Spec < MiniTest::Spec def retrieve(k, &block) response = instance_exec(@format, &block) - assert_equal @content_type, response.content_type - if @format == :xml - response.xml.namespaces["xmlns"].must_equal CIMI::Test::CIMI_NAMESPACE + if response.body && response.body.size > 0 + assert_equal @content_type, response.content_type + if @format == :xml + response.xml.namespaces["xmlns"].must_equal CIMI::Test::CIMI_NAMESPACE + end end response end -- 1.7.7.6