aboutsummaryrefslogtreecommitdiff
path: root/tests/swh.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-08-29 16:01:32 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-02 15:25:01 +0200
commit9323ab550f3bcb75fcaefbb20847595974702d5b (patch)
treecbe344ca4cc0db1da258e89ba017767084a5126a /tests/swh.scm
parentd34e9114e679666dfbf7caf577117010eca20520 (diff)
downloadguix-9323ab550f3bcb75fcaefbb20847595974702d5b.tar
guix-9323ab550f3bcb75fcaefbb20847595974702d5b.tar.gz
tests: 'with-http-server' accepts multiple responses.
* guix/tests/http.scm (call-with-http-server): Replace 'code' and 'data' parameters with 'responses+data'. Compute RESPONSES as a function of that. Remove #:headers parameter. [http-write]: Quit only when RESPONSES is empty. [server-body]: Get the response and data from RESPONSES, and set it to point to the rest. (with-http-server): Adjust accordingly. * tests/derivations.scm ("'download' built-in builder") ("'download' built-in builder, invalid hash") ("'download' built-in builder, not found") ("'download' built-in builder, check mode"): Adjust to new 'with-http-server' interface. * tests/lint.scm ("home-page: 200") ("home-page: 200 but short length") ("home-page: 404", "home-page: 301, invalid"): ("home-page: 301 -> 200", "home-page: 301 -> 404") ("source: 200", "source: 200 but short length") ("source: 404", "source: 404 and 200") ("source: 301 -> 200", "source: 301 -> 404"): ("github-url", github-url): Likewise. * tests/swh.scm (with-json-result) ("lookup-origin, not found"): Likewise.
Diffstat (limited to 'tests/swh.scm')
-rw-r--r--tests/swh.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/swh.scm b/tests/swh.scm
index 07f0fda37b..9a0da07ae1 100644
--- a/tests/swh.scm
+++ b/tests/swh.scm
@@ -40,7 +40,7 @@
\"dir_id\": 2 } ]")
(define-syntax-rule (with-json-result str exp ...)
- (with-http-server 200 str
+ (with-http-server `((200 ,str))
(parameterize ((%swh-base-url (%local-url)))
exp ...)))
@@ -56,7 +56,7 @@
(test-equal "lookup-origin, not found"
#f
- (with-http-server 404 "Nope."
+ (with-http-server `((404 "Nope."))
(parameterize ((%swh-base-url (%local-url)))
(lookup-origin "http://example.org/whatever"))))
@@ -72,5 +72,6 @@
;; Local Variables:
;; eval: (put 'with-json-result 'scheme-indent-function 1)
+;; eval: (put 'with-http-server 'scheme-indent-function 1)
;; End: