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 @@ -191,6 +191,31 @@ def test_utf8_encoding(self):
191
191
for idx , row in enumerate (self .db .query (query )):
192
192
self .assertEqual (texts [idx ], row .key )
193
193
194
+ def test_update_with_unsafe_doc_ids (self ):
195
+ doc_id = 'sanitise/the/doc/id/plz/'
196
+ design_doc = 'test_slashes_in_doc_ids'
197
+ handler_name = 'test'
198
+ func = """
199
+ function(doc, req) {
200
+ doc.test = 'passed';
201
+ return [doc, 'ok'];
202
+ }
203
+ """
204
+
205
+ # Stick an update handler in
206
+ self .db ['_design/%s' % design_doc ] = {
207
+ 'updates' : {handler_name : func }
208
+ }
209
+ # And a test doc
210
+ self .db [doc_id ] = {'test' : 'failed' }
211
+
212
+ response = self .db .update_doc (
213
+ '%s/%s' % (design_doc , handler_name ),
214
+ docid = doc_id
215
+ )
216
+
217
+ self .assertEqual (self .db [doc_id ]['test' ], 'passed' )
218
+
194
219
def test_design_docs (self ):
195
220
for i in range (50 ):
196
221
self .db [str (i )] = {'integer' : i , 'string' : str (i )}
You can’t perform that action at this time.
0 commit comments