[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#53389] [PATCH 2/9] tests: Generalise %local-url.
From: |
Maxime Devos |
Subject: |
[bug#53389] [PATCH 2/9] tests: Generalise %local-url. |
Date: |
Thu, 20 Jan 2022 13:08:42 +0000 |
* guix/tests/http.scm (%local-url): Extract most functionality to ...
(%local-url*): ... here and don't hardcode "/foo/bar".
---
guix/tests/http.scm | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/guix/tests/http.scm b/guix/tests/http.scm
index c42b4b8176..2f65df4029 100644
--- a/guix/tests/http.scm
+++ b/guix/tests/http.scm
@@ -31,6 +31,7 @@
call-with-http-server
call-with-http-server*
%http-server-port
+ %local-url*
%local-url))
;;; Commentary:
@@ -64,12 +65,14 @@ actually listened at (in case %http-server-port was 0)."
(strerror err))
(values #f #f)))))
-(define* (%local-url #:optional (port (%http-server-port)))
+(define* (%local-url* resource #:optional (port (%http-server-port)))
+ ;; The URL to the resource named RESOURCE on the current HTTP server.
(when (= port 0)
(error "no web server is running!"))
+ (string-append "http://localhost:" (number->string port) resource))
+(define* (%local-url #:optional (port (%http-server-port)))
;; URL to use for 'home-page' tests.
- (string-append "http://localhost:" (number->string port)
- "/foo/bar"))
+ (%local-url* "/foo/bar" port))
(define* (call-with-http-server* handle thunk #:key (keep-lingering? #false)
(last-response? (const #false)))
--
2.30.2
- [bug#53389] [PATCH 0/9] Replace some mocking with with-http-server*, avoid hardcoding ports,, Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 1/9] tests: Support arbitrary HTTP request handlers., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 2/9] tests: Generalise %local-url.,
Maxime Devos <=
- [bug#53389] [PATCH 3/9] tests/minetest: Run a HTTP server instead of mocking., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 8/9] tests/cpan: Verify URIs., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 5/9] tests/cpan: Do not hard code a HTTP port., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 6/9] tests/lint: Do not assume the next port is free., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 7/9] tests: Allow checking the URI of a HTTP request., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 9/9] tests/challenge: Do not hard code HTTP ports., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 4/9] tests/import-github: Run a HTTP server instead of mocking., Maxime Devos, 2022/01/20
- [bug#53389] [PATCH 0/9] Replace some mocking with with-http-server*, avoid hardcoding ports,, Ludovic Courtès, 2022/01/22