Skip to content

Commit de0c292

Browse files
authored
Fix generated tests due to Karate change (#90)
1 parent 5cceb2a commit de0c292

3 files changed

Lines changed: 35 additions & 26 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Solid Specification Conformance Tests
22

3+
## Release 0.0.13
4+
* Fix tests where scenarios are generated by a function (due to Karate change)
5+
36
## Release 0.0.12
47
* Use harness API to test sending requests without a content type header.
58
* Ensure container created correctly on slash semantic tests.

web-access-control/wac-allow/user-access-direct.feature

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
Feature: The WAC-Allow header shows user access modes for Bob when given direct access
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 testContainer = rootTestContainer.reserveContainer();
169
const resources = {}
17-
for (const row of testModes) {
10+
for (const modes of modesList) {
1811
const resource = testContainer.createResource('.ttl', karate.readAsString('../fixtures/example.ttl'), 'text/turtle');
1912
const access = resource.accessDatasetBuilder
20-
.setAgentAccess(resource.url, webIds.bob, row.modes)
13+
.setAgentAccess(resource.url, webIds.bob, modes)
2114
.build();
2215
resource.accessDataset = access;
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 an acl on the resource containing Bob's WebID
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 direct
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 direct
8790
And match result.user contains <check> <modes>
8891
And match result.public == []
8992
Examples:
90-
| testModes |
93+
| karate.setup().testModes |

web-access-control/wac-allow/user-access-indirect.feature

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
Feature: 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

Comments
 (0)