def testHandleGenericServiceErrorNoMessage(self): self.ResetServer(wsgi_util.error(six.moves.http_client.NOT_IMPLEMENTED, " ", content_type="text/plain")) rpc = self.connection.send_rpc(my_method.remote, self.request) try: rpc.response except remote.ServerError as err: self.assertEquals("HTTP Error 501: Not Implemented", str(err).strip()) else: self.fail("Expected ServerError")
def testHandleGenericServiceErrorNoMessage(self): self.ResetServer(wsgi_util.error(httplib.NOT_IMPLEMENTED, ' ', content_type='text/plain')) rpc = self.connection.send_rpc(my_method.remote, self.request) try: rpc.response except remote.ServerError, err: self.assertEquals('HTTP Error 501: Not Implemented', str(err).strip())
def testHandleGenericServiceError(self): self.ResetServer(wsgi_util.error(httplib.INTERNAL_SERVER_ERROR, 'arbitrary error', content_type='text/plain')) rpc = self.connection.send_rpc(my_method.remote, self.request) try: rpc.response except remote.ServerError, err: self.assertEquals('HTTP Error 500: arbitrary error', str(err).strip())
def testHandleGenericServiceError(self): self.ResetServer( wsgi_util.error(six.moves.http_client.INTERNAL_SERVER_ERROR, "arbitrary error", content_type="text/plain") ) rpc = self.connection.send_rpc(my_method.remote, self.request) try: rpc.response except remote.ServerError as err: self.assertEquals("HTTP Error 500: arbitrary error", str(err).strip()) else: self.fail("Expected ServerError")
def testHandleGenericServiceErrorNoMessage(self): self.ResetServer( wsgi_util.error(six.moves.http_client.NOT_IMPLEMENTED, ' ', content_type='text/plain')) rpc = self.connection.send_rpc(my_method.remote, self.request) try: rpc.response except remote.ServerError as err: self.assertEquals('HTTP Error 501: Not Implemented', str(err).strip()) else: self.fail('Expected ServerError')
def testHandleGenericServiceError(self): self.ResetServer( wsgi_util.error(six.moves.http_client.INTERNAL_SERVER_ERROR, 'arbitrary error', content_type='text/plain')) rpc = self.connection.send_rpc(my_method.remote, self.request) try: rpc.response except remote.ServerError as err: self.assertEquals('HTTP Error 500: arbitrary error', str(err).strip()) else: self.fail('Expected ServerError')
import six from six.moves import filter __author__ = '[email protected] (Rafe Kaplan)' import six.moves.http_client import unittest from protorpc import test_util from protorpc import util from protorpc import webapp_test_util from protorpc.wsgi import util as wsgi_util APP1 = wsgi_util.static_page('App1') APP2 = wsgi_util.static_page('App2') NOT_FOUND = wsgi_util.error(six.moves.http_client.NOT_FOUND) class WsgiTestBase(webapp_test_util.WebServerTestBase): server_thread = None def CreateWsgiApplication(self): return None def DoHttpRequest(self, path='/', content=None, content_type='text/plain; charset=utf-8', headers=None): connection = six.moves.http_client.HTTPConnection(
from six.moves import filter __author__ = '[email protected] (Rafe Kaplan)' import six.moves.http_client import unittest from protorpc import test_util from protorpc import util from protorpc import webapp_test_util from protorpc.wsgi import util as wsgi_util APP1 = wsgi_util.static_page('App1') APP2 = wsgi_util.static_page('App2') NOT_FOUND = wsgi_util.error(six.moves.http_client.NOT_FOUND) class WsgiTestBase(webapp_test_util.WebServerTestBase): server_thread = None def CreateWsgiApplication(self): return None def DoHttpRequest(self, path='/', content=None, content_type='text/plain; charset=utf-8', headers=None): connection = six.moves.http_client.HTTPConnection('localhost', self.port)
"""WSGI utility library tests.""" __author__ = '[email protected] (Rafe Kaplan)' import httplib import unittest from protorpc import test_util from protorpc import util from protorpc import webapp_test_util from protorpc.wsgi import util as wsgi_util APP1 = wsgi_util.static_page('App1') APP2 = wsgi_util.static_page('App2') NOT_FOUND = wsgi_util.error(httplib.NOT_FOUND) class WsgiTestBase(webapp_test_util.WebServerTestBase): server_thread = None def CreateWsgiApplication(self): return None def DoHttpRequest(self, path='/', content=None, content_type='text/plain; charset=utf-8', headers=None): connection = httplib.HTTPConnection('localhost', self.port)