summaryrefslogtreecommitdiff
path: root/guile/email-key-rotation/tests/fake-gandi-livedns.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guile/email-key-rotation/tests/fake-gandi-livedns.scm')
-rw-r--r--guile/email-key-rotation/tests/fake-gandi-livedns.scm23
1 files changed, 13 insertions, 10 deletions
diff --git a/guile/email-key-rotation/tests/fake-gandi-livedns.scm b/guile/email-key-rotation/tests/fake-gandi-livedns.scm
index 4a183ce..79bfcf0 100644
--- a/guile/email-key-rotation/tests/fake-gandi-livedns.scm
+++ b/guile/email-key-rotation/tests/fake-gandi-livedns.scm
@@ -5,6 +5,7 @@
#:use-module (ice-9 textual-ports)
#:use-module (ice-9 match)
#:use-module (ice-9 optargs)
+ #:use-module (ice-9 i18n)
#:use-module (json)
#:use-module (rnrs bytevectors)
#:use-module (web uri)
@@ -14,6 +15,8 @@
#:declarative? #t
#:duplicates (merge-generics))
+(define (G_ msg) (gettext msg "email-key-rotation"))
+
(define (fake-http-request expected-domain expected-api-key log-port)
(lambda* (uri #:key method headers body)
(unless (or (equal? method 'POST)
@@ -23,42 +26,42 @@
(make-error)
(make-exception-with-irritants (list method))
(make-exception-with-message
- "Gandi method is neither POST nor PUT"))))
+ (G_ "Gandi method is neither POST nor PUT")))))
(unless (equal? (uri-scheme uri) 'https)
(raise-exception
(make-exception
(make-error)
(make-exception-with-irritants (list uri))
(make-exception-with-message
- "Gandi URI is not HTTPS."))))
+ (G_ "Gandi URI is not HTTPS.")))))
(unless (equal? (uri-host uri) "api.gandi.net")
(raise-exception
(make-exception
(make-error)
(make-exception-with-irritants (list uri))
(make-exception-with-message
- "Wrong Gandi URI host."))))
+ (G_ "Wrong Gandi URI host.")))))
(when (uri-port uri)
(raise-exception
(make-exception
(make-error)
(make-exception-with-irritants (list uri))
(make-exception-with-message
- "Custom Gandi URI port."))))
+ (G_ "Custom Gandi URI port.")))))
(when (uri-userinfo uri)
(raise-exception
(make-exception
(make-error)
(make-exception-with-irritants (list uri))
(make-exception-with-message
- "Custom Gandi URI userinfo."))))
+ (G_ "Custom Gandi URI userinfo.")))))
(unless (string-prefix? "/" (uri-path uri))
(raise-exception
(make-exception
(make-error)
(make-exception-with-irritants (list uri))
(make-exception-with-message
- "Gandi URI path not absolute."))))
+ (G_ "Gandi URI path not absolute.")))))
(let ((path-components
(split-and-decode-uri-path (uri-path uri))))
(match path-components
@@ -71,7 +74,7 @@
(make-error)
(make-exception-with-irritants (list domain))
(make-exception-with-message
- "wrong domain in Gandi URI path."))))
+ (G_ "wrong domain in Gandi URI path.")))))
(unless (equal? (assoc-ref headers 'content-type)
'(application/json))
(raise-exception
@@ -79,7 +82,7 @@
(make-error)
(make-exception-with-irritants (list headers))
(make-exception-with-message
- "wrong content-type header."))))
+ (G_ "wrong content-type header.")))))
(unless (equal? (assoc-ref headers 'Authorization)
(string-append
"ApiKey " expected-api-key))
@@ -88,7 +91,7 @@
(make-error)
(make-exception-with-irritants (list headers))
(make-exception-with-message
- "wrong Authorization header."))))
+ (G_ "wrong Authorization header.")))))
(when (bytevector? body)
(set! body (utf8->string body)))
(match (json-string->scm body)
@@ -107,7 +110,7 @@
(raise-exception
(make-exception
(make-exception-with-origin 'call-with-fake-gandi-livedns)
- (make-exception-with-message "with fake gandi livedns:")
+ (make-exception-with-message (G_ "with fake gandi livedns:"))
exn)))
(lambda ()
(call-with-output-string