wsme/tests/rest/test_args.py
Alexandre Detiste c430488a25 replace undeclared use of old external "mock" module
Change-Id: I01260f759ac009a6d93f213a51799374e750acfd
2024-12-18 03:03:57 +01:00

21 lines
536 B
Python

from unittest 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, ((), {}))