summaryrefslogtreecommitdiff
path: root/tests/dpop-proof-iat-in-future.scm
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2021-08-01 14:51:28 +0200
committerVivien Kraus <vivien@planete-kraus.eu>2021-08-01 18:08:56 +0200
commitbae1843f1a1d644fb3bd4f8c40b1dbb900aa3325 (patch)
tree00f590033af904a6a493e41bdebe9b3ddd73043b /tests/dpop-proof-iat-in-future.scm
parentd8c2ca930673da858d63f2dea9526c259a2dd936 (diff)
Use guile parameters
With parameters, the API does not need to care about the directory where to load files and how to get the time.
Diffstat (limited to 'tests/dpop-proof-iat-in-future.scm')
-rw-r--r--tests/dpop-proof-iat-in-future.scm25
1 files changed, 12 insertions, 13 deletions
diff --git a/tests/dpop-proof-iat-in-future.scm b/tests/dpop-proof-iat-in-future.scm
index 4f167ca..b5dd3f8 100644
--- a/tests/dpop-proof-iat-in-future.scm
+++ b/tests/dpop-proof-iat-in-future.scm
@@ -19,6 +19,7 @@
(webid-oidc jwk)
(webid-oidc testing)
(webid-oidc errors)
+ ((webid-oidc parameters) #:prefix p:)
(web uri)
(srfi srfi-19)
(web response))
@@ -28,26 +29,24 @@
(lambda ()
(define jwk (generate-key #:n-size 2048))
(define cnf (jkt jwk))
- (define blacklist (make-jti-list))
(define proof
- (issue-dpop-proof
- jwk
- #:alg 'RS256
- #:htm 'GET
- #:htu (string->uri "https://example.com/res#frag")
- #:iat (time-utc->date (make-time time-utc 0 10))))
+ (parameterize ((p:current-date 10))
+ (issue-dpop-proof
+ jwk
+ #:alg 'RS256
+ #:htm 'GET
+ #:htu (string->uri "https://example.com/res#frag"))))
(with-exception-handler
(lambda (error)
(unless ((record-predicate &dpop-signed-in-future)
((record-accessor &cannot-decode-dpop-proof 'cause) error))
(raise-exception error)))
(lambda ()
- (dpop-proof-decode (time-utc->date (make-time time-utc 0 0))
- blacklist
- 'GET
- (string->uri "https://example.com/res?query")
- proof
- cnf)
+ (parameterize ((p:current-date 0))
+ (dpop-proof-decode 'GET
+ (string->uri "https://example.com/res?query")
+ proof
+ cnf))
(exit 2))
#:unwind? #t
#:unwind-for-type &cannot-decode-dpop-proof)))