Permalink
Browse files

working on test harness more

  • Loading branch information...
micha committed Mar 11, 2011
1 parent 15fb02f commit 26b3f3131be72cc788f90b2824ff5f293e988789
Showing with 31 additions and 35 deletions.
  1. +2 −2 test/Makefile
  2. +2 −2 test/runtests
  3. 0 test/{html-simple.resp → simple.html}
  4. +1 −0 test/simple.json
  5. +11 −11 test/tests
  6. +15 −20 test/tests.out
View
@@ -1,6 +1,6 @@
test:
- ./runtests tests html-simple.resp > tests.tmp 2>&1
+ ./runtests tests > tests.tmp 2>&1
diff tests.out tests.tmp |tee tests.log
record:
- ./runtests tests html-simple.resp > tests.out 2>&1
+ ./runtests tests > tests.out 2>&1
View
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
TEST=$1
-RESP=$2
PORT=${3:-9090}
. ../resty -W 127.0.0.1:$PORT
@@ -21,7 +20,8 @@ wait
# run tests again, this time checking actual output
( j=1
while true; do
- gnetcat -l -w 1 -p $PORT -e "cat $RESP" localhost || break
+ gnetcat -l -w 1 -p $PORT \
+ -e "read a b c; cat .\$(echo \$b |sed 's/?.*//')" localhost || break
grep '^# TEST [0-9][0-9]*' $TEST |head -$j |tail -1 && j=$((j+1))
done )&
File renamed without changes.
View
@@ -0,0 +1 @@
+{"foo":[1,2,3],"bar":{"dog":"woof","cat":"meow","fish":"banana"}}
View
@@ -1,32 +1,32 @@
# TEST 1: basic GET request
-GET /
+GET /simple.html
# TEST 2: basic PUT request
-PUT / 'here is some data'
+PUT /simple.html 'here is some data'
# TEST 3: basic POST request
-POST / 'here is some data'
+POST /simple.html 'here is some data'
# TEST 4: basic DELETE request
-DELETE /
+DELETE /simple.html
# TEST 5: basic TRACE request
-TRACE / 'here is some data'
+TRACE /simple.html 'here is some data'
# TEST 6: basic OPTIONS request
-OPTIONS /
+OPTIONS /simple.html
# TEST 7: Raw response
-GET / -Z
+GET /simple.html -Z
# TEST 8: Get headers too
-GET / -v 2>&1
+GET /simple.html -v 2>&1
# TEST 9: POST with data sent in query string
-POST /Test -d foo=bar -G
+POST /simple.html -d foo=bar -G
# TEST 10: POST with data sent in message body
-POST /Test '{foo: "bar"}'
+POST /simple.html '{foo: "bar"}'
# TEST 11: POST with extra header and basic auth, data in message body
-POST /Test -u "user:secret" -H "Accept: application/json" < Makefile
+POST /simple.html -u "user:secret" -H "Accept: application/json" < simple.json
View
@@ -1,11 +1,11 @@
# TEST 1: basic GET request
-GET / HTTP/1.1
+GET /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
# TEST 2: basic PUT request
-PUT / HTTP/1.1
+PUT /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
@@ -14,7 +14,7 @@ Content-Type: application/x-www-form-urlencoded
here is some data
# TEST 3: basic POST request
-POST / HTTP/1.1
+POST /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
@@ -23,13 +23,13 @@ Content-Type: application/x-www-form-urlencoded
here is some data
# TEST 4: basic DELETE request
-DELETE / HTTP/1.1
+DELETE /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
# TEST 5: basic TRACE request
-TRACE / HTTP/1.1
+TRACE /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
@@ -38,13 +38,13 @@ Content-Type: application/x-www-form-urlencoded
here is some data
# TEST 6: basic OPTIONS request
-OPTIONS / HTTP/1.1
+OPTIONS /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
# TEST 7: Raw response
-GET / HTTP/1.1
+GET /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
@@ -54,27 +54,27 @@ Accept: */*
* About to connect() to 127.0.0.1 port 9090 (#0)
* Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 9090 (#0)
-> GET / HTTP/1.1
+> GET /simple.html HTTP/1.1
> User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
> Host: 127.0.0.1:9090
> Accept: */*
>
{ [data not shown]
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0
-GET / HTTP/1.1
+GET /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
# TEST 9: POST with data sent in query string
-POST /Test?foo=bar HTTP/1.1
+POST /simple.html?foo=bar HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
# TEST 10: POST with data sent in message body
-POST /Test HTTP/1.1
+POST /simple.html HTTP/1.1
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: */*
@@ -83,20 +83,15 @@ Content-Type: application/x-www-form-urlencoded
{foo: "bar"}
# TEST 11: POST with extra header and basic auth, data in message body
-POST /Test HTTP/1.1
+POST /simple.html HTTP/1.1
Authorization: Basic dXNlcjpzZWNyZXQ=
User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
Host: 127.0.0.1:9090
Accept: application/json
-Content-Length: 160
+Content-Length: 66
Content-Type: application/x-www-form-urlencoded
-test:
-./runtests tests html-simple.resp > tests.tmp 2>&1
-diff tests.out tests.tmp |tee tests.log
-
-record:
-./runtests tests html-simple.resp > tests.out 2>&1
+{"foo":[1,2,3],"bar":{"dog":"woof","cat":"meow","fish":"banana"}}
# TEST 1: basic GET request
[1]fork me on github
@@ -346,7 +341,7 @@ Content-Length: 2340
* About to connect() to 127.0.0.1 port 9090 (#0)
* Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 9090 (#0)
-> GET / HTTP/1.1
+> GET /simple.html HTTP/1.1
> User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0d zlib/1.2.5 libidn/1.19
> Host: 127.0.0.1:9090
> Accept: */*

0 comments on commit 26b3f31

Please sign in to comment.