(use-modules (webid-oidc server precondition) (webid-oidc errors) (webid-oidc testing) (web http) (web request) (web response) (web uri) (ice-9 receive) (rnrs bytevectors)) (with-test-environment "preconditions" (lambda () (check-precondition "/whatever" #f #f #f) (check-precondition "/whatever" #f #f "etag") (check-precondition "/whatever" '* #f "etag") (check-precondition "/whatever" '* '() "etag") (check-precondition "/whatever" #f '("other") "etag") (check-precondition "/whatever" '("one" "etag" "or" "another") '() "etag") (with-exception-handler (lambda (error) (unless (precondition-failed? error) (exit 1))) (lambda () (check-precondition "/whatever" '("etag") '("etag") "etag")) #:unwind? #t #:unwind-for-type &precondition-failed) (with-exception-handler (lambda (error) (unless (precondition-failed? error) (exit 1))) (lambda () (check-precondition "/whatever" '("etag") '* "etag")) #:unwind? #t #:unwind-for-type &precondition-failed) (with-exception-handler (lambda (error) (unless (precondition-failed? error) (exit 1))) (lambda () (check-precondition "/whatever" '("nope") '() "etag")) #:unwind? #t #:unwind-for-type &precondition-failed) (with-exception-handler (lambda (error) (unless (precondition-failed? error) (exit 1))) (lambda () (check-precondition "/whatever" '("nope") '() "etag")) #:unwind? #t #:unwind-for-type &precondition-failed) (with-exception-handler (lambda (error) (unless (precondition-failed? error) (exit 1))) (lambda () (check-precondition "/whatever" '* #f #f)) #:unwind? #t #:unwind-for-type &precondition-failed) (with-exception-handler (lambda (error) (unless (precondition-failed? error) (exit 1))) (lambda () (check-precondition "/whatever" '() #f #f)) #:unwind? #t #:unwind-for-type &precondition-failed) (check-precondition "/whatever" #f '* #f) (check-precondition "/whatever" #f '() #f)))