File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,20 @@ describe('controllers/upload.js', function () {
37
37
}
38
38
}
39
39
} ;
40
+
41
+ mockLoginedRequestForbidden = {
42
+ session : {
43
+ user : {
44
+ _id : 'mock_user_id'
45
+ }
46
+ } ,
47
+ files : {
48
+ userfile : {
49
+ name : '/../../' + path . basename ( tmpFile ) ,
50
+ path : tmpFile
51
+ }
52
+ }
53
+ } ;
40
54
} ) ;
41
55
42
56
var oldUploadDir = config . upload_dir ;
@@ -83,6 +97,17 @@ describe('controllers/upload.js', function () {
83
97
} ) ;
84
98
} ) ;
85
99
100
+ it ( 'should forbidden when path err' , function ( done ) {
101
+ upload . uploadImage ( mockLoginedRequestForbidden , {
102
+ send : function ( data ) {
103
+ data . should . have . property ( 'status' , 'forbidden' ) ;
104
+ done ( ) ;
105
+ }
106
+ } , function ( ) {
107
+ throw new Error ( 'should not call this method' ) ;
108
+ } ) ;
109
+ } ) ;
110
+
86
111
it ( 'should upload file success' , function ( done ) {
87
112
upload . uploadImage ( mockLoginedRequest , {
88
113
send : function ( data ) {
You can’t perform that action at this time.
0 commit comments