Skip to content

Commit 52ccb14

Browse files
committed
More test cases for group ACLs
1 parent cb07411 commit 52ccb14

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

test/integration/acl-oidc-test.js

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,16 +529,55 @@ describe('ACL with WebID+OIDC over HTTP', function () {
529529
done()
530530
})
531531
})
532-
it('user2 should be able to access test directory',
532+
it('user2 should be able to access test directory', function (done) {
533+
var options = createOptions('/group/test-folder/', 'user2')
534+
535+
request.head(options, function (error, response, body) {
536+
assert.equal(error, null)
537+
assert.equal(response.statusCode, 200)
538+
done()
539+
})
540+
})
541+
it('user2 should be able to write a file in the test directory',
533542
function (done) {
534-
var options = createOptions('/group/test-folder/', 'user2')
543+
var options = createOptions('/group/test-folder/test.ttl', 'user2')
544+
options.body = '<#Dahut> a <https://dbpedia.org/resource/Category:French_legendary_creatures>.\n'
535545

536-
request.head(options, function (error, response, body) {
546+
request.put(options, function (error, response, body) {
537547
assert.equal(error, null)
538-
assert.equal(response.statusCode, 200)
548+
assert.equal(response.statusCode, 201)
539549
done()
540550
})
541551
})
552+
it('user1 should be able to get the file', function (done) {
553+
var options = createOptions('/group/test-folder/test.ttl', 'user1')
554+
555+
request.get(options, function (error, response, body) {
556+
assert.equal(error, null)
557+
assert.equal(response.statusCode, 200)
558+
done()
559+
})
560+
})
561+
it('user2 should not be able to write to the ACL',
562+
function (done) {
563+
var options = createOptions('/group/test-folder/.acl', 'user2')
564+
options.body = '<#Dahut> a <https://dbpedia.org/resource/Category:French_legendary_creatures>.\n'
565+
566+
request.put(options, function (error, response, body) {
567+
assert.equal(error, null)
568+
assert.equal(response.statusCode, 403)
569+
done()
570+
})
571+
})
572+
it('user1 should be able to delete the file', function (done) {
573+
var options = createOptions('/group/test-folder/test.ttl', 'user1')
574+
575+
request.delete(options, function (error, response, body) {
576+
assert.equal(error, null)
577+
assert.equal(response.statusCode, 200) // Should be 204, right?
578+
done()
579+
})
580+
})
542581
})
543582

544583
describe('Restricted', function () {

test/resources/accounts-acl/tim.localhost/group/test-folder/.acl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@prefix : <#>.
22
@prefix acl: <http://www.w3.org/ns/auth/acl#>.
33
@prefix tes: <./>.
4-
@prefix c: </profile/card#>.
4+
@prefix c: <https://tim.localhost:7777/profile/card#>.
55
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
66

77
:owner
@@ -13,4 +13,4 @@
1313
acl:accessTo tes:;
1414
acl:agentGroup <group-listing.ttl#folks>;
1515
acl:defaultForNew tes:;
16-
acl:mode acl:Read.
16+
acl:mode acl:Read, acl:Write.

0 commit comments

Comments
 (0)