diff options
Diffstat (limited to 'tests/jwks-get.scm')
-rw-r--r-- | tests/jwks-get.scm | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/jwks-get.scm b/tests/jwks-get.scm index 8e9169e..8f23492 100644 --- a/tests/jwks-get.scm +++ b/tests/jwks-get.scm @@ -1,4 +1,4 @@ -;; webid-oidc, implementation of the Solid specification +;; disfluid, implementation of the Solid specification ;; Copyright (C) 2020, 2021 Vivien Kraus ;; This program is free software: you can redistribute it and/or modify @@ -19,14 +19,17 @@ (webid-oidc cache) (web uri) (srfi srfi-19) - (web response)) + (web response) + (oop goops)) (with-test-environment "jwks-get" (lambda () - (define* (respond uri #:key (headers '())) + (define* (respond uri #:key (headers '()) (method 'GET)) (unless (null? headers) (exit 1)) + (unless (eq? method 'GET) + (exit 2)) (when (string? uri) (set! uri (string->uri uri))) (if (string=? (uri->string uri) "https://example.com/keys") @@ -54,16 +57,20 @@ ] } ") - (exit 2))) + (exit 3))) (define cache-http-get (with-cache #:http-get respond)) + (define* (cache-http-request uri #:key (headers '()) (method 'GET)) + (unless (eq? method 'GET) + (exit 4)) + (cache-http-get uri #:headers headers)) (define jwks (get-jwks "https://example.com/keys" - #:http-get cache-http-get)) - (define keys (jwks-keys jwks)) - (unless (eq? (length keys) 2) - (exit 3)) + #:http-request cache-http-request)) + (define the-keys (keys jwks)) + (unless (eq? (length the-keys) 2) + (exit 5)) (map (lambda (k) - (unless (jwk-public? k) - (exit 4))) - keys))) + (unless (is-a? k <public-key>) + (exit 6))) + the-keys))) |