@@ -234,14 +234,16 @@ class EditItemActionTestCase(ActionTestCase):
234234 def setUp (self ):
235235 ActionTestCase .setUp (self )
236236 self .result = []
237+ self .new_id = 16
237238 class AppendResult :
238239 def __init__ (inner_self , name ):
239240 inner_self .name = name
240241 def __call__ (inner_self , * args , ** kw ):
241242 self .result .append ((inner_self .name , args , kw ))
242243 if inner_self .name == 'set' :
243244 return kw
244- return '17'
245+ self .new_id += 1
246+ return str (self .new_id )
245247
246248 self .client .db .security .hasPermission = true
247249 self .client .classname = 'issue'
@@ -274,6 +276,24 @@ def testMessageAttach(self):
274276 pass
275277 self .assertEqual (expect , self .result )
276278
279+ def testMessageMultiAttach (self ):
280+ expect = \
281+ [ ('create' ,(),{'content' :'t2' })
282+ , ('create' ,(),{'content' :'t' })
283+ , ('set' ,('4711' ,), {'messages' :['23' ,'42' ,'17' ,'18' ]})
284+ ]
285+ self .client .db .classes .get = lambda a , b :['23' ,'42' ]
286+ self .client .parsePropsFromForm = lambda : \
287+ ( {('msg' ,'-1' ):{'content' :'t' },('msg' ,'-2' ):{'content' :'t2' }
288+ , ('issue' ,'4711' ):{}}
289+ , [('issue' ,'4711' ,'messages' ,[('msg' ,'-1' ),('msg' ,'-2' )])]
290+ )
291+ try :
292+ self .action .handle ()
293+ except Redirect , msg :
294+ pass
295+ self .assertEqual (expect , self .result )
296+
277297 def testFileAttach (self ):
278298 expect = \
279299 [('create' ,(),{'content' :'t' ,'type' :'text/plain' ,'name' :'t.txt' })
0 commit comments