@@ -3277,6 +3277,29 @@ def testPatchAction(self):
32773277 # verify the result
32783278 self .assertTrue (not self .db .issue .is_retired (issue_id ))
32793279
3280+ def testPatchBadAction (self ):
3281+ """
3282+ Test Patch Action 'Unknown'
3283+ """
3284+ # create a new issue with userid 1 and 2 in the nosy list
3285+ issue_id = self .db .issue .create (title = 'foo' )
3286+
3287+ # execute action retire
3288+ form = cgi .FieldStorage ()
3289+ etag = calculate_etag (self .db .issue .getnode (issue_id ),
3290+ self .db .config ['WEB_SECRET_KEY' ])
3291+ form .list = [
3292+ cgi .MiniFieldStorage ('@op' , 'action' ),
3293+ cgi .MiniFieldStorage ('@action_name' , 'unknown' ),
3294+ cgi .MiniFieldStorage ('@etag' , etag )
3295+ ]
3296+ results = self .server .patch_element ('issue' , issue_id , form )
3297+ self .assertEqual (self .dummy_client .response_code , 400 )
3298+ # verify the result, note order of allowed elements changes
3299+ # for python2/3 so just check prefix.
3300+ self .assertIn ('action "unknown" is not supported, allowed: ' ,
3301+ results ['error' ]['msg' ].args [0 ])
3302+
32803303 def testPatchRemove (self ):
32813304 """
32823305 Test Patch Action 'Remove' only some element from a list
0 commit comments