11Feature : The WAC-Allow header shows user access modes for Bob when given indirect access via a container
22
33 Background : Create test resources giving Bob different access modes
4- * table testModes
5- | test | modes | check |
6- | 'read ' | ['read '] | 'only ' |
7- | 'read /control ' | ['read ', 'control '] | 'only ' |
8- | 'read /write ' | ['read ', 'write '] | '' |
9- | 'read /append ' | ['read ', 'append '] | 'only ' |
10- | 'read /write /append ' | ['read ', 'write ', 'append '] | 'only ' |
11-
4+ * def modesList = [['read' ], ['read' , 'control' ], ['read' , 'write' ], ['read' , 'append' ], ['read' , 'write' , 'append' ]]
125 * def setup =
136 """
147 function() {
158 const resources = {}
16- for (const row of testModes ) {
9+ for (const modes of modesList ) {
1710 const testContainer = rootTestContainer.createContainer();
1811 const access = testContainer.accessDatasetBuilder
19- .setInheritableAgentAccess(testContainer.url, webIds.bob, row. modes)
12+ .setInheritableAgentAccess(testContainer.url, webIds.bob, modes)
2013 .build();
2114 testContainer.accessDataset = access;
2215 const resource = testContainer.createResource('.ttl', karate.readAsString('../fixtures/example.ttl'), 'text/turtle');
23- resources[row.test ] = resource;
16+ resources[modes.join('/') ] = resource;
2417 }
2518 return resources;
2619 }
2720 """
2821 * def resources = callonce setup
2922 * def resource = resources['read' ]
3023
24+ @setup
25+ Scenario : Define test cases
26+ * table testModes
27+ | test | modes | check |
28+ | 'read ' | ['read '] | 'only ' |
29+ | 'read /control ' | ['read ', 'control '] | 'only ' |
30+ | 'read /write ' | ['read ', 'write '] | '' |
31+ | 'read /append ' | ['read ', 'append '] | 'only ' |
32+ | 'read /write /append ' | ['read ', 'write ', 'append '] | 'only ' |
33+
3134 Scenario : There is no acl on the resource that references Bob
3235 Given url resource.aclUrl
3336 And headers clients.alice.getAuthHeaders('GET' , resource.aclUrl)
@@ -75,7 +78,7 @@ Feature: The WAC-Allow header shows user access modes for Bob when given indirec
7578 And match result.user contains <check> <modes>
7679 And match result.public == []
7780 Examples :
78- | testModes |
81+ | karate . setup (). testModes |
7982
8083 Scenario Outline : Bob calls HEAD on a resource with <test> access and the header shows <test> access for user
8184 Given url resources['<test>' ].url
@@ -87,4 +90,4 @@ Feature: The WAC-Allow header shows user access modes for Bob when given indirec
8790 And match result.user contains <check> <modes>
8891 And match result.public == []
8992 Examples :
90- | testModes |
93+ | karate . setup (). testModes |
0 commit comments