Skip to content

Commit 289193b

Browse files
committed
New HTTP test for the Access endpoint
1 parent 5fa932b commit 289193b

4 files changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
initialize_dataset "$END_USER_BASE_URL" "$TMP_END_USER_DATASET" "$END_USER_ENDPOINT_URL"
5+
initialize_dataset "$ADMIN_BASE_URL" "$TMP_ADMIN_DATASET" "$ADMIN_ENDPOINT_URL"
6+
purge_cache "$END_USER_VARNISH_SERVICE"
7+
purge_cache "$ADMIN_VARNISH_SERVICE"
8+
purge_cache "$FRONTEND_VARNISH_SERVICE"
9+
10+
slug="test"
11+
container="${END_USER_BASE_URL}${slug}/"
12+
13+
# check that the access metadata does not contain writers group membership
14+
15+
ntriples=$(curl -k -s -G \
16+
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
17+
-H "Accept: application/n-triples" \
18+
--data "this=${container}" \
19+
"${ADMIN_BASE_URL}access"
20+
)
21+
22+
if echo "$ntriples" | grep -q '<http://www.w3.org/ns/auth/acl#agentGroup> <https://localhost:4443/admin/acl/groups/writers/#this>'; then
23+
exit 1
24+
fi
25+
26+
# add agent to the writers group
27+
28+
add-agent-to-group.sh \
29+
-f "$OWNER_CERT_FILE" \
30+
-p "$OWNER_CERT_PWD" \
31+
--agent "$AGENT_URI" \
32+
"${ADMIN_BASE_URL}acl/groups/writers/"
33+
34+
# create container
35+
36+
create-container.sh \
37+
-f "$AGENT_CERT_FILE" \
38+
-p "$AGENT_CERT_PWD" \
39+
-b "$END_USER_BASE_URL" \
40+
--title "Test" \
41+
--slug "$slug" \
42+
--parent "$END_USER_BASE_URL"
43+
44+
# check that the access metadata does contain writers group membership
45+
46+
ntriples=$(curl -k -s -G \
47+
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
48+
-H "Accept: application/n-triples" \
49+
--data "this=${container}" \
50+
"${ADMIN_BASE_URL}access"
51+
)
52+
53+
if ! echo "$ntriples" | grep -q '<http://www.w3.org/ns/auth/acl#agentGroup> <https://localhost:4443/admin/acl/groups/writers/#this>'; then
54+
exit 1
55+
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)