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

Conversation

kjetilk
Copy link
Collaborator

@kjetilk kjetilk commented Dec 29, 2021

Here's an initial attempt at tests to protect containment triples, but it doesn't work. I'm trying to construct an array of the URLs with

    * def children = [ resource1.url, resource2.url, resource3.url, container1.url ]

but it seems to take that literally, because when I run the test, I get

  $ | actual does not contain expected | actual array does not contain expected item - resource1.url (LIST:LIST)
  ["https://solid-test-suite-alice.inrupt.net/shared-test/m98a02/yzyRp5/30Ax9A.txt","https://solid-test-suite-alice.inrupt.net/shared-test/m98a02/yzyRp5/30nN0E.txt","https://solid-test-suite-alice.inrupt.net/shared-test/m98a02/yzyRp5/3pjnp7/","https://solid-test-suite-alice.inrupt.net/shared-test/m98a02/yzyRp5/mpQypr.ttl"]
  ["resource1.url","resource2.url","resource3.url","container1.url"]

so, it seems it takes the variables as literals.

I have also tried

    * def children = []
    * def children[0] = resource1.url
    * def children[1] = resource2.url
    * def children[2] = resource3.url
    * def children[3] = container1.url

but then I get

no step-definition method match found for: def children[0] = resource1.url
../data/protocol/writing-resource/protect-containment.feature:11

@kjetilk kjetilk marked this pull request as ready for review January 19, 2022 01:29
@kjetilk
Copy link
Collaborator Author

kjetilk commented Jan 19, 2022

The tests that are there now working. We can discuss whether we should have tests for PATCH too before we merge.

@edwardsph
Copy link
Collaborator

The requirement says the server must not allow something to update its containment triples. This test focusses on invalid containment triples but should it also confirm that we can't add valid ones or change any with new valid ones? Should the test confirm that you can use PUT to add something like a title?

@edwardsph
Copy link
Collaborator

This test is repetitive and could be converted to the ScenarioOutline style where the test title and payload are put into a table in the Background.

@kjetilk
Copy link
Collaborator Author

kjetilk commented Jan 20, 2022

The requirement says the server must not allow something to update its containment triples. This test focusses on invalid containment triples but should it also confirm that we can't add valid ones or change any with new valid ones?

Good point. Indeed, these tests would fail in that they modify the containment triples that aren't there. So yes, these tests aren't good. Instead, we should GET the container representation, change one or more of the containment triples and PUT them back.

@kjetilk kjetilk marked this pull request as draft January 20, 2022 12:34
@solid-contrib solid-contrib deleted a comment from sonarcloud bot Oct 7, 2022
@edwardsph
Copy link
Collaborator

This test should also demonstrate that valid changes can be made to the container resource, then we are proving that only the containment triples are being protected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants