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

Resolve location headers against base URL. #110

Merged
merged 1 commit into from
Jan 9, 2024
Merged
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
Resolve location headers against base URL.
Fix run script interpolation.
Update test subject details.
  • Loading branch information
edwardsph committed Jan 9, 2024
commit 6c3c1e9aa9ba12bbe146f0d3680a69ffbced887b
2 changes: 1 addition & 1 deletion protocol/cors/preflight-requests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Feature: Server must implement the CORS protocol for preflight requests
And header Access-Control-Request-Headers = 'X-CUSTOM, Content-Type'
When method OPTIONS
Then match [301, 308] contains responseStatus
* def location = karate.response.headerValues('location')[0]
* def location = resolveUri(testContainer.url, karate.response.headerValues('location')[0])

Given url location
And header Origin = 'https://tester'
Expand Down
2 changes: 1 addition & 1 deletion protocol/cors/preflight.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: Server must support HTTP OPTIONS for CORS preflight requests
And header Access-Control-Request-Headers = 'X-CUSTOM, Content-Type'
When method OPTIONS
Then match [301, 308] contains responseStatus
* def location = karate.response.headerValues('location')[0]
* def location = resolveUri(testContainer.url, karate.response.headerValues('location')[0])

Given url location
And header Origin = 'https://tester'
Expand Down
9 changes: 5 additions & 4 deletions protocol/writing-resource/slash-semantics-exclude.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Feature: With and without trailing slash cannot co-exist
Given url childContainerUrl
And headers clients.alice.getAuthHeaders('PUT', childContainerUrl)
And header Content-Type = 'text/turtle'
And header Link = '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"'
When method PUT
Then assert responseStatus >= 200 && responseStatus < 300

Expand Down Expand Up @@ -60,7 +61,7 @@ Feature: With and without trailing slash cannot co-exist
And header Link = '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"'
When method POST
Then assert responseStatus >= 200 && responseStatus < 300
And def childContainerUrl = karate.response.headerValues('location')[0]
And def childContainerUrl = resolveUri(testContainer.url, karate.response.headerValues('location')[0])
And assert childContainerUrl.endsWith('/')

# confirm there is no non-container resource with the same URI
Expand All @@ -87,7 +88,7 @@ Feature: With and without trailing slash cannot co-exist
And request 'Hello'
When method POST
# this should either succeed (without using the slug) or fail as a conflict
Then assert (responseStatus >= 200 && responseStatus < 300 && karate.response.headerValues('location')[0] != resourceUrl) || [409, 415].includes(responseStatus)
Then assert (responseStatus >= 200 && responseStatus < 300 && resolveUri(testContainer.url, karate.response.headerValues('location')[0]) != resourceUrl) || [409, 415].includes(responseStatus)

Scenario: POST resource, then try container with same name
Given url testContainer.url
Expand All @@ -96,7 +97,7 @@ Feature: With and without trailing slash cannot co-exist
And request 'Hello'
When method POST
Then assert responseStatus >= 200 && responseStatus < 300
And def resourceUrl = karate.response.headerValues('location')[0]
And def resourceUrl = resolveUri(testContainer.url, karate.response.headerValues('location')[0])
And assert !resourceUrl.endsWith('/')

# confirm there is no container with the same URI
Expand All @@ -122,6 +123,6 @@ Feature: With and without trailing slash cannot co-exist
And header Link = '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"'
When method POST
# this should either succeed (without using the slug) or fail as a conflict
Then assert (responseStatus >= 200 && responseStatus < 300 && karate.response.headerValues('location')[0] != resourceUrl + '/') || [409, 415].includes(responseStatus)
Then assert (responseStatus >= 200 && responseStatus < 300 && resolveUri(testContainer.url, karate.response.headerValues('location')[0]) != resourceUrl + '/') || [409, 415].includes(responseStatus)

# TODO: Evil test to check various suffices.
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ then
dockerargs+=('--env-file=css-creds.env' '--network=testnet')
harnessargs+=('--skip-teardown')
else
dockerargs+=('--env-file=$envfile')
dockerargs+=("--env-file=$envfile")
fi

# optionally pull published CTH image
Expand Down
16 changes: 8 additions & 8 deletions test-subjects.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
rdfs:comment "Access for anonymous users is not supported nor required by Solid specifications so tests that depend on this are not run."@en.

<ess#test-subject-release>
doap:revision "2.0";
doap:created "2022-06-07"^^xsd:date .
doap:revision "2.1";
doap:created "2023-03-28"^^xsd:date .

<css>
a earl:Software, earl:TestSubject ;
Expand All @@ -37,8 +37,8 @@
solid-test:skip "acp", "http-redirect" .

<css#test-subject-release>
doap:revision "5.0.0" ;
doap:created "2022-08-08"^^xsd:date .
doap:revision "7.0.3" ;
doap:created "2024-01-05"^^xsd:date .

<nss>
a earl:Software, earl:TestSubject ;
Expand All @@ -51,8 +51,8 @@
solid-test:skip "acp" .

<nss#test-subject-release>
doap:revision "5.7.3"@en ;
doap:created "2022-09-22"^^xsd:date .
doap:revision "5.7.7"@en ;
doap:created "2023-03-17"^^xsd:date .

<trinpod>
a earl:Software, earl:TestSubject ;
Expand All @@ -66,5 +66,5 @@
solid-test:skip "acp" .

<trinpod#test-subject-release>
doap:revision "2.3.197"@en ;
doap:created "2022-01-25"^^xsd:date .
doap:revision "3.2.397"@en ;
doap:created "2024-01-09"^^xsd:date .