예제 #1
0
    def test_parse_body_empty_body(self):
        """ Test parsing of an empty message body. """
        body = None

        response = None

        self.mox.ReplayAll()

        unsafe_handler = UnsafeCommandHandler()
        self.assertEquals(response, unsafe_handler.parse_body(body))
예제 #2
0
    def test_parse_body(self):
        """ Test parsing of a message body. """
        body = "c"

        args = body.split()
        command = args.pop(0)

        response = "a response"

        self.mox.StubOutWithMock(UnsafeCommandHandler, "do_command")

        UnsafeCommandHandler.do_command(command, args).AndReturn(response)

        self.mox.ReplayAll()

        unsafe_handler = UnsafeCommandHandler()
        self.assertEquals(response, unsafe_handler.parse_body(body))