[PATCH] tests: check for root xml and json
Jim Meyering
jim at meyering.net
Mon Sep 27 17:30:04 UTC 2010
Jim Meyering wrote:
> Jeff Darcy wrote:
>> Also, I've attached a first cut at a list of tests that we should
>> (eventually) have. We should probably get together some time soon to
>> determine additions, prioritization, assignment, etc. Some tests it
>> might make sense to defer until I'm done with the API-reconciliation
>> task, for example.
>
> Thanks.
>
>> IWHD Test Cases
>> ===============
>>
>> A. API Root and Bucket Operations
>> -------------------
>>
>> A1. Fetch API root. Verify presence of factory/provider entries.
>>
>> A2. Fetch using explicit Accept: for JSON/XML.
>
> This covers A1 and A2:
>
>>From e281b0e21e0974574cc05e3932713c56e0c6529d Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Mon, 27 Sep 2010 18:40:56 +0200
> Subject: [PATCH] tests: check for root xml and json
That patch probably would not have applied, because it
depended on a stub, which I've merged into the following.
However, this may depend on a preceding:
tests: remove unnecessary "kill..." stmt, now it's done via trap
>From 64b6f426e9aec084c493b0285f3c40961688e5b0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 27 Sep 2010 18:29:35 +0200
Subject: [PATCH] tests: check for root xml and json
---
t/basic | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/t/basic b/t/basic
index 4936ac6..0de042a 100644
--- a/t/basic
+++ b/t/basic
@@ -19,11 +19,40 @@ wait_for .1 30 'mongo < /dev/null' \
# Once that is fixed, we won't need this "cd".
cd iwhd
+port=9091
+cat <<EOF > root.xml || framework_failure_
+<api service="image_warehouse" version="$VERSION">
+ <link rel="bucket_factory" href="http://localhost:$port/_new"/>
+ <link rel="provider_list" href="http://localhost:$port/_providers"/>
+ <link rel="bucket" href="http://localhost:$port/b1"/>
+</api>
+EOF
+
+cat <<EOF > root.json || framework_failure_
+{
+ "service": "image_warehouse",
+ "version": "$VERSION",
+ [
+ {
+ "rel": "bucket_factory",
+ "link": "http://localhost:$port/_new"
+ },
+ {
+ "rel": "provider_list",
+ "link": "http://localhost:$port/_providers"
+ },
+ {
+ "rel": "bucket",
+ "link": "http://localhost:$port/b1"
+ }
+ ]
+}
+EOF
+
# "path": "FS"
printf '[{"type": "fs", "name": "primary"}]\n' \
> iwhd.cfg || fail=1
-port=9091
iwhd -v -p $port -c iwhd.cfg &
iwhd_pid=$!
cleanup_() { kill $mongo_pid $iwhd_pid; }
@@ -41,4 +70,10 @@ echo foo | curl -T - http://localhost:$port/b1/f1 || fail=1
test -f b1/f1 || fail=1
test "$(cat b1/f1)" = foo || fail=1
+curl http://localhost:$port > root || fail=1
+compare root root.xml || fail=1
+
+curl -H 'Accept: */json' http://localhost:$port > root || fail=1
+compare root root.json || fail=1
+
Exit $fail
--
1.7.3.264.g8bb1
More information about the iwhd-devel
mailing list