Repository navigation
Simple RDF validation for ACL files #937
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
Changes from all commits
3b3ba58
ebfe3f3
c541613
ea9b40c
18a7a04
0e3392f
48da61c
f35e458
6d845b1
5b94a22
331dc0c
afbe557
29c115f
1be27f7
5a39e8e
a0232e2
af58d66
8b0e8e7
fae913d
9a936fc
cd5dfdd
b5cfcf6
d939f7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,14 @@ | ||
| var assert = require('chai').assert | ||
| var supertest = require('supertest') | ||
| var path = require('path') | ||
| var nock = require('nock') | ||
| var { checkDnsSettings } = require('../utils') | ||
|
|
||
| var ldnode = require('../../index') | ||
| var { checkDnsSettings, setupSupertestServer } = require('../utils') | ||
|
|
||
| describe('CORS Proxy', () => { | ||
| var ldp = ldnode({ | ||
| var server = setupSupertestServer({ | ||
| root: path.join(__dirname, '../resources'), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, if you want to go cross-platform,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is it necessary though? It seems like path.join will normalize it nevertheless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, you made me look at the source code of The call to |
||
| corsProxy: '/proxy', | ||
| webid: false | ||
| }) | ||
| var server = supertest(ldp) | ||
|
|
||
| before(checkDnsSettings) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| const fs = require('fs') | ||
| const path = require('path') | ||
| const { setupSupertestServer } = require('../utils') | ||
|
|
||
| const server = setupSupertestServer({ | ||
| live: true, | ||
| dataBrowserPath: 'default', | ||
| root: path.join(__dirname, '../resources'), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd have split it to |
||
| auth: 'oidc', | ||
| webid: false | ||
| }) | ||
|
|
||
| const invalidTurtleBody = fs.readFileSync(path.join(__dirname, '../resources/invalid1.ttl'), { | ||
| 'encoding': 'utf8' | ||
| }) | ||
|
|
||
| describe('HTTP requests with invalid Turtle syntax', () => { | ||
| describe('PUT API', () => { | ||
| it('is allowed with invalid TTL files in general', (done) => { | ||
| server.put('/invalid1.ttl') | ||
| .send(invalidTurtleBody) | ||
| .set('content-type', 'text/turtle') | ||
| .expect(201, done) | ||
| }) | ||
|
|
||
| it('is not allowed with invalid ACL files', (done) => { | ||
| server.put('/invalid1.ttl.acl') | ||
| .send(invalidTurtleBody) | ||
| .set('content-type', 'text/turtle') | ||
| .expect(400, done) | ||
| }) | ||
| }) | ||
|
|
||
| describe('PATCH API', () => { | ||
| it('does not support patching of TTL files', (done) => { | ||
| server.patch('/patch-1-initial.ttl') | ||
| .send(invalidTurtleBody) | ||
| .set('content-type', 'text/turtle') | ||
| .expect(415, done) | ||
| }) | ||
| }) | ||
|
|
||
| describe('POST API (multipart)', () => { | ||
| it('does not validate files that are posted', (done) => { | ||
| server.post('/') | ||
| .attach('invalid1', path.join(__dirname, '../resources/invalid1.ttl')) | ||
| .attach('invalid2', path.join(__dirname, '../resources/invalid2.ttl')) | ||
| .expect(200, done) | ||
| }) | ||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| @prefix ldp: <http://www.w3.org/ns/ldp#>. | ||
| @prefix o: <http://example.org/ontology#>. | ||
|
|
||
| <http://example.org/netWorth/nw1/> | ||
| test o:NetWorth; | ||
| o:netWorthOf <http://example.org/users/JohnZSmith>; | ||
| o:asset | ||
| <assets/a1>, | ||
| <assets/a2>; | ||
| o:liability | ||
| <liabilities/l1>, | ||
| <liabilities/l2>, | ||
| <liabilities/l3>. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| @prefix txn: <http://example.org/data/transaction/> . | ||
| @prefix srv: <http://example.org/data/server/> . | ||
| @prefix log: <http://example.org/ont/transaction-log/> . | ||
| @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
|
||
| txn:123 invalid log:Transaction ; | ||
| log:processedBy srv:A ; | ||
| log:processedAt "2015-10-16T10:22:23"^^xsd:dateTime ; | ||
| log:statusCode 200 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a
varinstead of aconst?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency.