Skip to content
Snippets Groups Projects
Commit 09127904 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

RAPI client: Fix error message for unsupported methods in unittest


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarDavid Knowles <dknowles@google.com>
parent d9b67f70
No related branches found
No related tags found
No related merge requests found
......@@ -107,8 +107,8 @@ class RapiMock(object):
HandlerClass, items, args = self._mapper.getController(path)
self._last_handler = HandlerClass(items, args, None)
if not hasattr(self._last_handler, method.upper()):
code = 400
response = "Bad request"
code = 501
response = "Method not implemented"
except http.HttpException, ex:
code = ex.code
response = ex.message
......@@ -120,12 +120,11 @@ class RapiMock(object):
class RapiMockTest(unittest.TestCase):
def test(self):
rapi = RapiMock()
path = "/version"
self.assertEqual((404, None), rapi.FetchResponse("/foo", "GET"))
self.assertEqual((400, "Bad request"),
self.assertEqual((501, "Method not implemented"),
rapi.FetchResponse("/version", "POST"))
rapi.AddResponse("2")
code, response = rapi.FetchResponse("/version", "GET")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment