@@ -138,7 +138,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
138138 done ( )
139139 } )
140140 } )
141- it ( 'user1 as solid:owner should let edit the .acl' , function ( done ) {
141+ it ( 'user1 as solid:owner should let edit the .acl' , function ( done ) { // alain
142142 const options = createOptions ( '/empty-acl/.acl' , 'user1' , 'text/turtle' )
143143 options . body = ''
144144 request . put ( options , function ( error , response , body ) {
@@ -209,7 +209,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
209209 done ( )
210210 } )
211211 } )
212- it ( 'Should not create empty acl file' , function ( done ) {
212+ it ( 'Should not create empty acl file' , function ( done ) { // alain
213213 const options = createOptions ( '/write-acl/empty-acl/another-empty-folder/.acl' , 'user1' , 'text/turtle' )
214214 options . body = ''
215215 request . put ( options , function ( error , response , body ) {
@@ -273,7 +273,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
273273 } )
274274
275275 describe ( 'no-control' , function ( ) {
276- it ( 'user1 as owner should edit acl file' , function ( done ) {
276+ it ( 'user1 as owner should edit acl file' , function ( done ) { // alain
277277 const options = createOptions ( '/no-control/.acl' , 'user1' , 'text/turtle' )
278278 options . body = '<#0>' +
279279 '\n a <http://www.w3.org/ns/auth/acl#Authorization>;' +
@@ -571,6 +571,27 @@ describe('ACL with WebID+OIDC over HTTP', function () {
571571 done ( )
572572 } )
573573 } )
574+ it ( 'user1 should be able to PUT (which CREATEs) (non existent resource)' , function ( done ) {
575+ const options = createOptions ( '/append-inherited/test1.ttl' , 'user1' )
576+ options . body = '<a> <b> <c> .\n'
577+ options . headers [ 'content-type' ] = 'text/turtle'
578+ request . put ( options , function ( error , response , body ) {
579+ assert . equal ( error , null )
580+ assert . equal ( response . statusCode , 201 )
581+ done ( )
582+ } )
583+ } )
584+ it ( 'user2 should not be able to PUT with Append (existing resource)' , function ( done ) {
585+ const options = createOptions ( '/append-inherited/test1.ttl' , 'user2' )
586+ options . body = '<a> <b> <c> .\n'
587+ options . headers [ 'content-type' ] = 'text/turtle'
588+ request . put ( options , function ( error , response , body ) {
589+ assert . equal ( error , null )
590+ assert . equal ( response . statusCode , 403 )
591+ assert . include ( response . statusMessage , 'User Unauthorized' )
592+ done ( )
593+ } )
594+ } )
574595 it ( 'user1 should be able to access test file' , function ( done ) {
575596 const options = createOptions ( '/append-acl/abc.ttl' , 'user1' )
576597 request . head ( options , function ( error , response , body ) {
@@ -599,6 +620,16 @@ describe('ACL with WebID+OIDC over HTTP', function () {
599620 done ( )
600621 } )
601622 } )
623+ it ( 'user2 should be able to PUT to (which CREATEs) a non existent resource' , function ( done ) { // alain
624+ const options = createOptions ( '/append-inherited/new1.ttl' , 'user1' )
625+ options . body = '<a> <b> <c> .\n'
626+ options . headers [ 'content-type' ] = 'text/turtle'
627+ request . put ( options , function ( error , response , body ) {
628+ assert . equal ( error , null )
629+ assert . equal ( response . statusCode , 201 )
630+ done ( )
631+ } )
632+ } )
602633 it ( 'user2 should not be able to access test file\'s ACL file' , function ( done ) {
603634 const options = createOptions ( '/append-acl/abc.ttl.acl' , 'user2' , 'text/turtle' )
604635 request . head ( options , function ( error , response , body ) {
@@ -627,13 +658,13 @@ describe('ACL with WebID+OIDC over HTTP', function () {
627658 done ( )
628659 } )
629660 } )
630- it ( 'user2 (with append permission) cannot use PUT to append ' , function ( done ) {
661+ it ( 'user2 (with append permission) cannot use PUT on an existing resource ' , function ( done ) {
631662 const options = createOptions ( '/append-acl/abc.ttl' , 'user2' , 'text/turtle' )
632663 options . body = '<d> <e> <f> .\n'
633664 request . put ( options , function ( error , response , body ) {
634665 assert . equal ( error , null )
635666 assert . equal ( response . statusCode , 403 )
636- assert . equal ( response . statusMessage , 'User Unauthorized' )
667+ assert . include ( response . statusMessage , 'Can\'t write file/folder: User Unauthorized' )
637668 done ( )
638669 } )
639670 } )
@@ -652,13 +683,15 @@ describe('ACL with WebID+OIDC over HTTP', function () {
652683 request . put ( options , function ( error , response , body ) {
653684 assert . equal ( error , null )
654685 assert . equal ( response . statusCode , 401 )
655- assert . equal ( response . statusMessage , 'Unauthenticated' )
686+ assert . include ( response . statusMessage , 'Can\'t write file/folder: Unauthenticated' )
656687 done ( )
657688 } )
658689 } )
659690 after ( function ( ) {
660691 rm ( '/accounts-acl/tim.localhost/append-inherited/test.ttl' )
692+ rm ( '/accounts-acl/tim.localhost/append-inherited/test1.ttl' )
661693 rm ( '/accounts-acl/tim.localhost/append-inherited/new.ttl' )
694+ rm ( '/accounts-acl/tim.localhost/append-inherited/new1.ttl' )
662695 } )
663696 } )
664697
0 commit comments