示例#1
0
 def setUp(self):
     from wheezy.web.handlers.base import BaseHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {}
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {}}
     self.handler = handler_factory(BaseHandler, self.mock_request)
     assert isinstance(self.handler, BaseHandler)
示例#2
0
 def setUp(self):
     from wheezy.web.handlers.base import BaseHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {
         'RESUBMISSION_NAME': '_r'
     }
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {}}
     self.mock_request.root_path = 'my_site/'
     self.mock_request.cookies = {}
     self.handler = handler_factory(BaseHandler, self.mock_request)
     assert isinstance(self.handler, BaseHandler)
示例#3
0
 def setUp(self):
     from wheezy.web.handlers.base import BaseHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {
         'AUTH_COOKIE': '_a'
     }
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {'locale': 'en'}}
     self.mock_request.root_path = 'my_site/'
     self.mock_request.cookies = {}
     self.handler = handler_factory(BaseHandler, self.mock_request)
     assert isinstance(self.handler, BaseHandler)
示例#4
0
 def setUp(self):
     from wheezy.core.url import urlparts
     from wheezy.web.handlers.base import BaseHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {}
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {}}
     self.mock_request.method = 'GET'
     self.mock_request.root_path = 'my_site/'
     self.mock_request.urlparts = urlparts(
         scheme='https', netloc='python.org')
     self.handler = handler_factory(BaseHandler, self.mock_request)
     assert isinstance(self.handler, BaseHandler)
示例#5
0
 def setUp(self):
     from wheezy.web.handlers.file import FileHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {
     }
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.route_args = {}
     self.mock_request.environ = {
         'route_args': self.route_args
     }
     self.mock_request.root_path = 'my_site/'
     self.handler = handler_factory(
         FileHandler,
         self.mock_request,
         root=rootdir)
示例#6
0
 def setUp(self):
     from wheezy.core.url import urlparts
     from wheezy.web.handlers.base import RedirectRouteHandler
     from wheezy.web.handlers.method import handler_factory
     mock_path_for = Mock(return_value='welcome')
     self.options = {'path_for': mock_path_for}
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {}}
     self.mock_request.method = 'GET'
     self.mock_request.root_path = 'my_site/'
     self.mock_request.urlparts = urlparts(
         scheme='https', netloc='python.org')
     self.handler = handler_factory(
         RedirectRouteHandler,
         self.mock_request,
         'default')
     assert isinstance(self.handler, RedirectRouteHandler)
示例#7
0
 def setUp(self):
     from wheezy.web.handlers.base import BaseHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {
         'AUTH_COOKIE': '_a',
         'AUTH_COOKIE_PATH': 'members',
         'AUTH_COOKIE_DOMAIN': 'python.org',
         'AUTH_COOKIE_SECURE': True,
         'HTTP_COOKIE_SECURE': False,
         'HTTP_COOKIE_HTTPONLY': False
     }
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {}}
     self.mock_request.root_path = 'my_site/'
     self.mock_request.cookies = {}
     self.handler = handler_factory(BaseHandler, self.mock_request)
     assert isinstance(self.handler, BaseHandler)
示例#8
0
 def setUp(self):
     from wheezy.core.url import urlparts
     from wheezy.web.handlers.base import BaseHandler
     from wheezy.web.handlers.method import handler_factory
     self.options = {
         'AUTH_COOKIE': '_a',
         'AUTH_COOKIE_PATH': 'members',
         'AUTH_COOKIE_DOMAIN': 'python.org',
         'AUTH_COOKIE_SECURE': True,
         'HTTP_COOKIE_SECURE': False,
         'HTTP_COOKIE_HTTPONLY': False,
         'translations_manager': {'en': 'translations'}
     }
     self.mock_request = Mock()
     self.mock_request.options = self.options
     self.mock_request.environ = {'route_args': {'locale': 'en'}}
     self.mock_request.method = 'GET'
     self.mock_request.root_path = 'my_site/'
     self.mock_request.cookies = {}
     self.mock_request.urlparts = urlparts(
         scheme='https', netloc='python.org')
     self.handler = handler_factory(BaseHandler, self.mock_request)
     assert isinstance(self.handler, BaseHandler)