def render(self, request): """ Leave the request open for future writes. """ self.request = request if request.method not in self.allowedMethods: raise error.UnsupportedMethod(self.allowedMethods) self.request.write(b"some data") return server.NOT_DONE_YET
def test_str(self): """ The C{__str__} for L{UnsupportedMethod} makes it clear that what it shows is a list of the supported methods, not the method that was unsupported. """ e = error.UnsupportedMethod([b"HEAD", b"PATCH"]) self.assertEqual( str(e), "Expected one of [b'HEAD', b'PATCH']", )