Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protecting containment triples #66

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions protocol/solid-protocol-test-manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,10 @@ manifest:slug-uri-assignment
spec:testScript
<https://github.com/solid/specification-tests/protocol/read-write-resource/post-uri-assignment-slug.feature> .

manifest:protect-containment
a td:TestCase ;
spec:requirementReference sopr:server-protect-containment ;
td:reviewStatus td:unreviewed ;
spec:testScript
<https://github.com/solid/specification-tests/protocol/writing-resource/protect-containment.feature> .

82 changes: 82 additions & 0 deletions protocol/writing-resource/protect-containment.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Feature: Server protects containment triples

Background: Set up container and a few child resources
* def testContainer = rootTestContainer.createContainer()
* def exampleTurtle = karate.readAsString('../fixtures/example.ttl')
* def resource1 = testContainer.createResource('.ttl', exampleTurtle, 'text/turtle');
* def resource2 = testContainer.createResource('.txt', 'DAHUT', 'text/plain');
* def resource3 = testContainer.createResource('.txt', 'FOOBAR', 'text/plain');
* def container1 = testContainer.createContainer()
* def children = ([ resource1.url, resource2.url, resource3.url, container1.url ])

Scenario: PUT invalid object to container
Given url testContainer.url
And headers clients.alice.getAuthHeaders('GET', testContainer.url)
When method GET
Then status 200
* def contained = parse(response, 'text/turtle', testContainer.url).members
And match contained contains only children
And match children contains only contained

Given url testContainer.url
And headers clients.alice.getAuthHeaders('PUT', testContainer.url)
And header Content-Type = 'text/turtle'
And request '<> <http://www.w3.org/ns/ldp#contains> </foobar>.'
When method PUT
Then status 409

Given url testContainer.url
And headers clients.alice.getAuthHeaders('GET', testContainer.url)
When method GET
Then status 200
* def contained = parse(response, 'text/turtle', testContainer.url).members
And match contained contains only children
And match children contains only contained

Scenario: PUT invalid subject and object to container
Given url testContainer.url
And headers clients.alice.getAuthHeaders('GET', testContainer.url)
When method GET
Then status 200
* def contained = parse(response, 'text/turtle', testContainer.url).members
And match contained contains only children
And match children contains only contained

Given url testContainer.url
And headers clients.alice.getAuthHeaders('PUT', testContainer.url)
And header Content-Type = 'text/turtle'
And request '</dahut/> <http://www.w3.org/ns/ldp#contains> </foobar>.'
When method PUT
Then status 409

Given url testContainer.url
And headers clients.alice.getAuthHeaders('GET', testContainer.url)
When method GET
Then status 200
* def contained = parse(response, 'text/turtle', testContainer.url).members
And match contained contains only children
And match children contains only contained

Scenario: PUT invalid subject to container
Given url testContainer.url
And headers clients.alice.getAuthHeaders('GET', testContainer.url)
When method GET
Then status 200
* def contained = parse(response, 'text/turtle', testContainer.url).members
And match contained contains only children
And match children contains only contained

Given url testContainer.url
And headers clients.alice.getAuthHeaders('PUT', testContainer.url)
And header Content-Type = 'text/turtle'
And request '</dahut/> <http://www.w3.org/ns/ldp#contains> <' + resource1.url + '> .'
When method PUT
Then status 409

Given url testContainer.url
And headers clients.alice.getAuthHeaders('GET', testContainer.url)
When method GET
Then status 200
* def contained = parse(response, 'text/turtle', testContainer.url).members
And match contained contains only children
And match children contains only contained