From 516729ac8976a6e9ab3c43cef7b754ec6a7518a3 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 9 Nov 2008 02:02:26 +0000 Subject: Minor tweaks. --- repoze/bfg/testing.py | 17 +++++++++++++---- repoze/bfg/tests/test_testing.py | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/repoze/bfg/testing.py b/repoze/bfg/testing.py index 8bfcac58e..55ecc6d17 100644 --- a/repoze/bfg/testing.py +++ b/repoze/bfg/testing.py @@ -230,28 +230,37 @@ class DummyModel: class DummyRequest: """ A dummy request object (imitates a WebOb request object) """ implements(IRequest) - def __init__(self, path='/', params=None, environ=None, headers=None, **kw): + method = 'GET' + application_url = 'http://example.com' + host = 'example.com:80' + def __init__(self, params=None, environ=None, headers=None, path='/', + cookies=None, **kw): if environ is None: environ = {} if params is None: params = {} if headers is None: headers = {} + if cookies is None: + cookies = {} self.environ = environ self.headers = headers self.params = params + self.cookies = cookies self.GET = params self.POST = params - self.application_url = 'http://example.com' self.host_url = self.application_url self.path_url = self.application_url + self.url = self.application_url self.path = path self.path_info = path self.script_name = '' self.path_qs = '' - self.url = self.application_url - self.host = 'example.com:80' self.body = '' self.cookies = {} + self.view_name = '' + self.subpath = [] + self.context = None + self.marshalled = params # repoze.monty self.__dict__.update(kw) diff --git a/repoze/bfg/tests/test_testing.py b/repoze/bfg/tests/test_testing.py index 6d133ee93..03f5bd938 100644 --- a/repoze/bfg/tests/test_testing.py +++ b/repoze/bfg/tests/test_testing.py @@ -290,10 +290,10 @@ class TestDummyRequest(unittest.TestCase): return self._getTargetClass()(*arg, **kw) def test_it(self): - request = self._makeOne('/abc', - params = {'say':'Hello'}, + request = self._makeOne(params = {'say':'Hello'}, environ = {'PATH_INFO':'/foo'}, headers = {'X-Foo':'YUP'}, + path = '/abc', water = 1) self.assertEqual(request.path, '/abc') self.assertEqual(request.params['say'], 'Hello') -- cgit v1.2.3