Fix error: variable 'kw' referenced before assignment
Change-Id: Ife95d74bf645687dc4595b16434c88ee874c2f95 Closes-bug: #1311742
This commit is contained in:
parent
8e6077e270
commit
1a918b5bba
20
tests/rest/test_args.py
Normal file
20
tests/rest/test_args.py
Normal file
@ -0,0 +1,20 @@
|
||||
import mock
|
||||
import unittest
|
||||
|
||||
from wsme import exc
|
||||
from wsme.rest import args
|
||||
from wsme.rest import json
|
||||
|
||||
|
||||
class TestArgs(unittest.TestCase):
|
||||
|
||||
def test_args_from_body(self):
|
||||
|
||||
funcdef = mock.MagicMock()
|
||||
body = mock.MagicMock()
|
||||
mimetype = "application/json"
|
||||
funcdef.ignore_extra_args = True
|
||||
json.parse = mock.MagicMock()
|
||||
json.parse.side_effect = (exc.UnknownArgument(""))
|
||||
resp = args.args_from_body(funcdef, body, mimetype)
|
||||
self.assertEqual(resp, ((), {}))
|
@ -232,6 +232,7 @@ def args_from_body(funcdef, body, mimetype):
|
||||
except UnknownArgument:
|
||||
if not funcdef.ignore_extra_args:
|
||||
raise
|
||||
kw = {}
|
||||
|
||||
return (), kw
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user