Skip to content

Commit 6db7b33

Browse files
Add WAC tests (#1508)
* Add test/surface/ * Add WAC tests * keep mocha out of test/surface/
1 parent 953ee97 commit 6db7b33

File tree

100 files changed

+1920
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1920
-14
lines changed

lib/acl-checker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ const ACL = rdf.Namespace('http://www.w3.org/ns/auth/acl#')
1717

1818
// TODO: expunge-on-write so that we can increase the caching time
1919
// For now this cache is a big performance gain but very simple
20-
const EXPIRY_MS = 10000 // 10 seconds
20+
// FIXME: set this through the config system instead of directly
21+
// through an env var:
22+
const EXPIRY_MS = parseInt(process.env.ACL_CACHE_TIME) || 10000 // 10 seconds
2123
let temporaryCache = {}
2224

2325
// An ACLChecker exposes the permissions on a specific resource

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@
139139
"solid": "node ./bin/solid",
140140
"standard": "standard '{bin,examples,lib,test}/**/*.js'",
141141
"validate": "node ./test/validate-turtle.js",
142-
"nyc": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 nyc --reporter=text-summary mocha --recursive test/",
143-
"mocha": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/",
142+
"nyc": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 nyc --reporter=text-summary mocha --recursive test/integration/ test/unit/",
143+
"mocha": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 mocha --recursive test/integration/ test/unit/",
144144
"prepublishOnly": "npm test",
145145
"postpublish": "git push --follow-tags",
146146
"test": "npm run standard && npm run validate && npm run nyc",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
app/node_modules
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM node
2+
ADD app /app
3+
WORKDIR /app
4+
RUN npm install
5+
ENV NODE_TLS_REJECT_UNAUTHORIZED 0
6+
CMD node index.js
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const fetch = require('node-fetch')
2+
3+
const SERVER_ROOT = process.env.SERVER_ROOT || 'https://server'
4+
const LOGIN_URL = `${SERVER_ROOT}/login/password`
5+
const USERNAME = process.env.USERNAME || 'alice'
6+
const PASSWORD = process.env.PASSWORD || '123'
7+
8+
async function getCookie () {
9+
const result = await fetch(LOGIN_URL, {
10+
body: [
11+
`username=${USERNAME}`,
12+
`password=${PASSWORD}`
13+
].join('&'),
14+
headers: {
15+
'Content-Type': 'application/x-www-form-urlencoded'
16+
},
17+
method: 'POST',
18+
redirect: 'manual'
19+
})
20+
return result.headers.get('set-cookie')
21+
}
22+
23+
async function run () {
24+
const cookie = await getCookie()
25+
console.log(cookie)
26+
}
27+
28+
// ...
29+
run()

test/surface/docker/cookie/app/package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "get-nss-cookie",
3+
"version": "1.0.0",
4+
"description": "Get a cookie from a node-solid-server instance",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"node-fetch": "^2.6.1"
13+
}
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"redirect_uris":["https://server/api/oidc/rp/https%3A%2F%2Fserver"],"client_id":"7e5c0fede7682892e36b2ef3ecda05a6","client_secret":"d634791ff779ce90d378d714282e1374","response_types":["code","id_token token","code id_token token"],"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"application_type":"web","client_name":"Solid OIDC RP for https://server","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic","default_max_age":86400,"post_logout_redirect_uris":["https://server/goodbye"]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"redirect_uris":["http://localhost:3001/redirect"],"client_id":"coolApp1","client_secret":"9ae94c0a2f86a02a5dfa8d0a522f8176","response_types":["code"],"grant_types":["authorization_code"],"application_type":"web","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"redirect_uris":["http://localhost:3002/redirect"],"client_id":"coolApp","client_secret":"9ae94c0a2f86a02a5dfa8d0a522f8176","response_types":["code"],"grant_types":["authorization_code"],"application_type":"web","id_token_signed_response_alg":"RS256","token_endpoint_auth_method":"client_secret_basic"}

0 commit comments

Comments
 (0)