summaryrefslogtreecommitdiff
path: root/tests/acl.scm
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2021-09-22 13:11:21 +0200
committerVivien Kraus <vivien@planete-kraus.eu>2021-09-22 18:08:47 +0200
commit555e59deba33284067298ce6130c379c75e3d2a3 (patch)
treec15c823913e917bc474f1cf163caf65a117ee9c3 /tests/acl.scm
parent0d74f8c1ca9c1e9bf9a04b85f598ba7a175d1d86 (diff)
Use anonymous-http-request from (webid-oidc parameters) everywhere
Diffstat (limited to 'tests/acl.scm')
-rw-r--r--tests/acl.scm93
1 files changed, 46 insertions, 47 deletions
diff --git a/tests/acl.scm b/tests/acl.scm
index 3d76c54..9a11eb6 100644
--- a/tests/acl.scm
+++ b/tests/acl.scm
@@ -17,6 +17,7 @@
(use-modules (webid-oidc server resource wac)
(webid-oidc server resource content)
(webid-oidc server resource path)
+ ((webid-oidc parameters) #:prefix p:)
(webid-oidc testing)
(web http)
(web request)
@@ -203,54 +204,52 @@
(define (run-test path modes-alice modes-bob modes-fbi modes-anonymous)
(define (uri< a b)
(string< (uri->string a) (uri->string b)))
- (let ((alice (wac-get-modes
+ (parameterize
+ ((p:anonymous-http-request http-get))
+ (let ((alice (wac-get-modes
+ server-name path
+ (string->uri "https://alice.databox.me/profile/card#me")))
+ (bob (wac-get-modes
server-name path
- (string->uri "https://alice.databox.me/profile/card#me")
- #:http-get http-get))
- (bob (wac-get-modes
- server-name path
- (string->uri "https://bob.databox.me/profile/card#me")
- #:http-get http-get))
- (fbi (wac-get-modes
- server-name path
- (string->uri "https://the-spy.databox.me/profile/card#me")
- #:http-get http-get))
- (anonymous (wac-get-modes
- server-name path
- #f
- #:http-get http-get)))
- (unless (equal? alice
- modes-alice)
- (format (current-error-port)
- "Alice’s modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
- path
- (map uri->string modes-alice)
- (map uri->string alice))
- (exit 2))
- (unless (equal? bob
- modes-bob)
- (format (current-error-port)
- "Bob’s modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
- path
- (map uri->string modes-bob)
- (map uri->string bob))
- (exit 3))
- (unless (equal? fbi
- modes-fbi)
- (format (current-error-port)
- "Spy’s modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
- path
- (map uri->string modes-fbi)
- (map uri->string fbi))
- (exit 4))
- (unless (equal? anonymous
- modes-anonymous)
- (format (current-error-port)
- "Anonymous modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
- path
- (map uri->string modes-anonymous)
- (map uri->string anonymous))
- (exit 5))))
+ (string->uri "https://bob.databox.me/profile/card#me")))
+ (fbi (wac-get-modes
+ server-name path
+ (string->uri "https://the-spy.databox.me/profile/card#me")))
+ (anonymous (wac-get-modes
+ server-name path
+ #f)))
+ (unless (equal? alice
+ modes-alice)
+ (format (current-error-port)
+ "Alice’s modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
+ path
+ (map uri->string modes-alice)
+ (map uri->string alice))
+ (exit 2))
+ (unless (equal? bob
+ modes-bob)
+ (format (current-error-port)
+ "Bob’s modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
+ path
+ (map uri->string modes-bob)
+ (map uri->string bob))
+ (exit 3))
+ (unless (equal? fbi
+ modes-fbi)
+ (format (current-error-port)
+ "Spy’s modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
+ path
+ (map uri->string modes-fbi)
+ (map uri->string fbi))
+ (exit 4))
+ (unless (equal? anonymous
+ modes-anonymous)
+ (format (current-error-port)
+ "Anonymous modes for path ~s:\n expected:\n ~s\n got:\n ~s\n"
+ path
+ (map uri->string modes-anonymous)
+ (map uri->string anonymous))
+ (exit 5)))))
(let ((read (string->uri "http://www.w3.org/ns/auth/acl#Read"))
(write (string->uri "http://www.w3.org/ns/auth/acl#Write"))
(control (string->uri "http://www.w3.org/ns/auth/acl#Control")))