@@ -135,16 +135,32 @@ describe('ACL HTTP', function() {
135135 } ) ;
136136 } )
137137 describe ( "with defaultForNew in parent path" , function ( ) {
138+ it ( "should fail to create a container" , function ( done ) {
139+ var options = createOptions ( '/acl/write-acl/empty-acl/test-folder/' , 'user1' ) ;
140+ options . body = "" ;
141+ request . put ( options , function ( error , response , body ) {
142+ assert . equal ( response . statusCode , 409 ) ;
143+ done ( ) ;
144+ } ) ;
145+ } ) ;
138146 it ( "should allow creation of new files" , function ( done ) {
139- var options = createOptions ( '/acl/write-acl/empty-acl/test-folder' , 'user1' ) ;
147+ var options = createOptions ( '/acl/write-acl/empty-acl/test-file' , 'user1' ) ;
148+ options . body = "" ;
149+ request . put ( options , function ( error , response , body ) {
150+ assert . equal ( response . statusCode , 201 ) ;
151+ done ( ) ;
152+ } ) ;
153+ } ) ;
154+ it ( "should allow creation of new files in deeper paths" , function ( done ) {
155+ var options = createOptions ( '/acl/write-acl/empty-acl/test-folder/test-file' , 'user1' ) ;
140156 options . body = "" ;
141157 request . put ( options , function ( error , response , body ) {
142158 assert . equal ( response . statusCode , 201 ) ;
143159 done ( ) ;
144160 } ) ;
145161 } ) ;
146162 it ( "Should create empty acl file" , function ( done ) {
147- var options = createOptions ( testDirAclFile , 'user1' ) ;
163+ var options = createOptions ( '/acl/write-acl/empty-acl/another-empty-folder/test-file.acl' , 'user1' ) ;
148164 options . headers = {
149165 'content-type' : 'text/turtle'
150166 } ;
@@ -156,7 +172,7 @@ describe('ACL HTTP', function() {
156172 } ) ;
157173 } ) ;
158174 it ( "Should return text/turtle for the acl file" , function ( done ) {
159- var options = createOptions ( testDirAclFile , 'user1' ) ;
175+ var options = createOptions ( '/acl/write-acl/.acl' , 'user1' ) ;
160176 options . headers = {
161177 accept : 'text/turtle'
162178 } ;
@@ -168,7 +184,7 @@ describe('ACL HTTP', function() {
168184 } ) ;
169185 } ) ;
170186 it ( "Should create test file" , function ( done ) {
171- var options = createOptions ( abcFile , 'user1' ) ;
187+ var options = createOptions ( '/acl/write-acl/test-file' , 'user1' ) ;
172188 options . headers = {
173189 'content-type' : 'text/turtle'
174190 } ;
@@ -180,7 +196,7 @@ describe('ACL HTTP', function() {
180196 } ) ;
181197 } ) ;
182198 it ( "Should create test file's acl file" , function ( done ) {
183- var options = createOptions ( abcAclFile , 'user1' ) ;
199+ var options = createOptions ( '/acl/write-acl/test-file.acl' , 'user1' ) ;
184200 options . headers = {
185201 'content-type' : 'text/turtle'
186202 } ;
@@ -192,7 +208,7 @@ describe('ACL HTTP', function() {
192208 } ) ;
193209 } ) ;
194210 it ( "Should access test file's acl file" , function ( done ) {
195- var options = createOptions ( abcAclFile , 'user1' ) ;
211+ var options = createOptions ( '/acl/write-acl/test-file.acl' , 'user1' ) ;
196212 options . headers = {
197213 accept : 'text/turtle'
198214 } ;
@@ -208,20 +224,21 @@ describe('ACL HTTP', function() {
208224
209225 describe ( "Origin" , function ( ) {
210226 it ( "Should PUT new ACL file" , function ( done ) {
211- var options = createOptions ( testDirAclFile , 'user1' ) ;
227+ var options = createOptions ( '/acl/origin/test-folder/.acl' , 'user1' ) ;
212228 options . headers = {
213229 'content-type' : 'text/turtle'
214230 } ;
215231 options . body = "<#Owner>\n" +
216- " <http://www.w3.org/ns/auth/acl#accessTo> <" + address + testDir + "/" + ">, <" + address + testDirAclFile + ">;\n" +
232+ " <http://www.w3.org/ns/auth/acl#accessTo> <" + address + "acl/origin/test-folder/" + ">;\n" +
217233 " <http://www.w3.org/ns/auth/acl#agent> <" + user1 + ">;\n" +
218234 " <http://www.w3.org/ns/auth/acl#origin> <" + origin1 + ">;\n" +
219235 " <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read>, <http://www.w3.org/ns/auth/acl#Write> .\n" +
220236 "<#Public>\n" +
221- " <http://www.w3.org/ns/auth/acl#accessTo> <" + address + testDir + " /" + ">;\n" +
237+ " <http://www.w3.org/ns/auth/acl#accessTo> <" + address + "acl/origin/test-folder /" + ">;\n" +
222238 " <http://www.w3.org/ns/auth/acl#agentClass> <http://xmlns.com/foaf/0.1/Agent>;\n" +
223239 " <http://www.w3.org/ns/auth/acl#origin> <" + origin1 + ">;\n" +
224240 " <http://www.w3.org/ns/auth/acl#mode> <http://www.w3.org/ns/auth/acl#Read> .\n" ;
241+ console . log ( options . body )
225242 request . put ( options , function ( error , response , body ) {
226243 assert . equal ( error , null ) ;
227244 assert . equal ( response . statusCode , 201 ) ;
@@ -231,7 +248,7 @@ describe('ACL HTTP', function() {
231248 } ) ;
232249 } ) ;
233250 it ( "user1 should be able to access test directory" , function ( done ) {
234- var options = createOptions ( testDir + ' /', 'user1' ) ;
251+ var options = createOptions ( '/acl/origin/test-folder /', 'user1' ) ;
235252 request . head ( options , function ( error , response , body ) {
236253 assert . equal ( error , null ) ;
237254 assert . equal ( response . statusCode , 200 ) ;
@@ -240,7 +257,7 @@ describe('ACL HTTP', function() {
240257 } ) ;
241258 it ( "user1 should be able to access to test directory when origin is valid" ,
242259 function ( done ) {
243- var options = createOptions ( testDir , 'user1' ) ;
260+ var options = createOptions ( '/acl/origin/test-folder/' , 'user1' ) ;
244261 options . headers = {
245262 origin : origin1
246263 } ;
@@ -252,7 +269,7 @@ describe('ACL HTTP', function() {
252269 } ) ;
253270 it ( "user1 should be denied access to test directory when origin is invalid" ,
254271 function ( done ) {
255- var options = createOptions ( testDir , 'user1' ) ;
272+ var options = createOptions ( '/acl/origin/test-folder/' , 'user1' ) ;
256273 options . headers = {
257274 origin : origin2
258275 } ;
@@ -263,7 +280,7 @@ describe('ACL HTTP', function() {
263280 } ) ;
264281 } ) ;
265282 it ( "agent should be able to access test directory" , function ( done ) {
266- var options = createOptions ( testDir ) ;
283+ var options = createOptions ( '/acl/origin/test-folder/' ) ;
267284 request . head ( options , function ( error , response , body ) {
268285 assert . equal ( error , null ) ;
269286 assert . equal ( response . statusCode , 200 ) ;
@@ -272,7 +289,7 @@ describe('ACL HTTP', function() {
272289 } ) ;
273290 it ( "agent should be able to access to test directory when origin is valid" ,
274291 function ( done ) {
275- var options = createOptions ( testDir , 'user1' ) ;
292+ var options = createOptions ( '/acl/origin/test-folder/' , 'user1' ) ;
276293 options . headers = {
277294 origin : origin1
278295 } ;
@@ -284,7 +301,7 @@ describe('ACL HTTP', function() {
284301 } ) ;
285302 it ( "agent should be denied access to test directory when origin is invalid" ,
286303 function ( done ) {
287- var options = createOptions ( testDir ) ;
304+ var options = createOptions ( '/acl/origin/test-folder/' ) ;
288305 options . headers = {
289306 origin : origin2
290307 } ;
0 commit comments