@@ -84,95 +84,126 @@ describe('ACL HTTP', function() {
8484 }
8585
8686
87- describe ( 'Basic ' , function ( ) {
88- it ( 'Should return "Hello, World!" ' , function ( done ) {
89- var options = createOptions ( 'hello.html ' , 'user1' ) ;
87+ describe ( 'No ACL ' , function ( ) {
88+ it ( 'should return 403 for any resource ' , function ( done ) {
89+ var options = createOptions ( '/acl/no-acl ' , 'user1' ) ;
9090 request ( options , function ( error , response , body ) {
91- assert . equal ( response . statusCode , 200 ) ;
92- assert . match ( response . headers [ 'content-type' ] , / t e x t \/ h t m l / ) ;
91+ assert . equal ( response . statusCode , 403 ) ;
9392 done ( ) ;
9493 } ) ;
9594 } ) ;
96- it ( "Should return User header " , function ( done ) {
97- var options = createOptions ( 'hello.html ' , 'user1' ) ;
95+ it ( "should have User in the Header " , function ( done ) {
96+ var options = createOptions ( '/acl/no-acl ' , 'user1' ) ;
9897 request ( options , function ( error , response , body ) {
99- assert . equal ( response . statusCode , 200 ) ;
100- assert . equal ( response . headers . user , user1 ) ;
98+ assert . equal ( response . statusCode , 403 ) ;
10199 done ( ) ;
102100 } ) ;
103101 } ) ;
104102 } ) ;
105103
106- describe ( "Empty .acl" , function ( ) {
107- it ( "Should create test folder" , function ( done ) {
108- var options = createOptions ( testDirMetaFile , 'user1' ) ;
109- options . body = "" ;
110- request . put ( options , function ( error , response , body ) {
111- assert . equal ( error , null ) ;
112- assert . equal ( response . statusCode , 201 ) ;
113- done ( ) ;
104+ describe ( "empty .acl" , function ( ) {
105+ describe ( "with no defaultForNew in parent path" , function ( ) {
106+ it ( "should give no access" , function ( done ) {
107+ var options = createOptions ( '/acl/empty-acl/test-folder' , 'user1' ) ;
108+ options . body = "" ;
109+ request . put ( options , function ( error , response , body ) {
110+ assert . equal ( response . statusCode , 403 ) ;
111+ done ( ) ;
112+ } ) ;
114113 } ) ;
115- } ) ;
116- it ( "Should create empty acl file" , function ( done ) {
117- var options = createOptions ( testDirAclFile , 'user1' ) ;
118- options . headers = {
119- 'content-type' : 'text/turtle'
120- } ;
121- options . body = '' ;
122- request . put ( options , function ( error , response , body ) {
123- assert . equal ( error , null ) ;
124- assert . equal ( response . statusCode , 201 ) ;
125- done ( ) ;
114+ it ( "should not let edit the .acl" , function ( done ) {
115+ var options = createOptions ( '/acl/empty-acl/.acl' , 'user1' ) ;
116+ options . headers = {
117+ 'content-type' : 'text/turtle'
118+ } ;
119+ options . body = '' ;
120+ request . put ( options , function ( error , response , body ) {
121+ assert . equal ( response . statusCode , 403 ) ;
122+ done ( ) ;
123+ } ) ;
126124 } ) ;
127- } ) ;
128- it ( "Should return text/turtle for the acl file" , function ( done ) {
129- var options = createOptions ( testDirAclFile , 'user1' ) ;
130- options . headers = {
131- accept : 'text/turtle'
132- } ;
133- request . get ( options , function ( error , response , body ) {
134- assert . equal ( error , null ) ;
135- assert . equal ( response . statusCode , 200 ) ;
136- assert . match ( response . headers [ 'content-type' ] , / t e x t \/ t u r t l e / ) ;
137- done ( ) ;
125+ it ( "should not let read the .acl" , function ( done ) {
126+ var options = createOptions ( '/acl/empty-acl/.acl' , 'user1' ) ;
127+ options . headers = {
128+ accept : 'text/turtle'
129+ } ;
130+ request . get ( options , function ( error , response , body ) {
131+ assert . equal ( error , null ) ;
132+ assert . equal ( response . statusCode , 403 ) ;
133+ done ( ) ;
134+ } ) ;
138135 } ) ;
139- } ) ;
140- it ( "Should create test file" , function ( done ) {
141- var options = createOptions ( abcFile , 'user1' ) ;
142- options . headers = {
143- 'content-type' : 'text/turtle'
144- } ;
145- options . body = '<a> <b> <c> .' ;
146- request . put ( options , function ( error , response , body ) {
147- assert . equal ( error , null ) ;
148- assert . equal ( response . statusCode , 201 ) ;
149- done ( ) ;
136+ } )
137+ describe ( "with defaultForNew in parent path" , function ( ) {
138+ it ( "should allow creation of new containers" , 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 , 200 ) ;
143+ done ( ) ;
144+ } ) ;
150145 } ) ;
151- } ) ;
152- it ( "Should create test file's acl file" , function ( done ) {
153- var options = createOptions ( abcAclFile , 'user1' ) ;
154- options . headers = {
155- 'content-type' : 'text/turtle'
156- } ;
157- options . body = '' ;
158- request . put ( options , function ( error , response , body ) {
159- assert . equal ( error , null ) ;
160- assert . equal ( response . statusCode , 201 ) ;
161- done ( ) ;
146+ it ( "Should create empty acl file" , function ( done ) {
147+ var options = createOptions ( testDirAclFile , 'user1' ) ;
148+ options . headers = {
149+ 'content-type' : 'text/turtle'
150+ } ;
151+ options . body = '' ;
152+ request . put ( options , function ( error , response , body ) {
153+ assert . equal ( error , null ) ;
154+ assert . equal ( response . statusCode , 201 ) ;
155+ done ( ) ;
156+ } ) ;
162157 } ) ;
163- } ) ;
164- it ( "Should access test file's acl file" , function ( done ) {
165- var options = createOptions ( abcAclFile , 'user1' ) ;
166- options . headers = {
167- accept : 'text/turtle'
168- } ;
169- request . get ( options , function ( error , response , body ) {
170- assert . equal ( error , null ) ;
171- assert . equal ( response . statusCode , 200 ) ;
172- assert . match ( response . headers [ 'content-type' ] , / t e x t \/ t u r t l e / ) ;
173- done ( ) ;
158+ it ( "Should return text/turtle for the acl file" , function ( done ) {
159+ var options = createOptions ( testDirAclFile , 'user1' ) ;
160+ options . headers = {
161+ accept : 'text/turtle'
162+ } ;
163+ request . get ( options , function ( error , response , body ) {
164+ assert . equal ( error , null ) ;
165+ assert . equal ( response . statusCode , 200 ) ;
166+ assert . match ( response . headers [ 'content-type' ] , / t e x t \/ t u r t l e / ) ;
167+ done ( ) ;
168+ } ) ;
174169 } ) ;
175- } ) ;
170+ it ( "Should create test file" , function ( done ) {
171+ var options = createOptions ( abcFile , 'user1' ) ;
172+ options . headers = {
173+ 'content-type' : 'text/turtle'
174+ } ;
175+ options . body = '<a> <b> <c> .' ;
176+ request . put ( options , function ( error , response , body ) {
177+ assert . equal ( error , null ) ;
178+ assert . equal ( response . statusCode , 201 ) ;
179+ done ( ) ;
180+ } ) ;
181+ } ) ;
182+ it ( "Should create test file's acl file" , function ( done ) {
183+ var options = createOptions ( abcAclFile , 'user1' ) ;
184+ options . headers = {
185+ 'content-type' : 'text/turtle'
186+ } ;
187+ options . body = '' ;
188+ request . put ( options , function ( error , response , body ) {
189+ assert . equal ( error , null ) ;
190+ assert . equal ( response . statusCode , 201 ) ;
191+ done ( ) ;
192+ } ) ;
193+ } ) ;
194+ it ( "Should access test file's acl file" , function ( done ) {
195+ var options = createOptions ( abcAclFile , 'user1' ) ;
196+ options . headers = {
197+ accept : 'text/turtle'
198+ } ;
199+ request . get ( options , function ( error , response , body ) {
200+ assert . equal ( error , null ) ;
201+ assert . equal ( response . statusCode , 200 ) ;
202+ assert . match ( response . headers [ 'content-type' ] , / t e x t \/ t u r t l e / ) ;
203+ done ( ) ;
204+ } ) ;
205+ } ) ;
206+ } )
176207 } ) ;
177208
178209 describe ( "Origin" , function ( ) {
0 commit comments