diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-11-09 02:02:26 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-11-09 02:02:26 +0000 |
| commit | 516729ac8976a6e9ab3c43cef7b754ec6a7518a3 (patch) | |
| tree | d2526a216843b82d6387f3c6952f3372244feaa0 | |
| parent | a9a8a2dcfa3381ee9da3550f84dcadd55825e1d4 (diff) | |
| download | pyramid-516729ac8976a6e9ab3c43cef7b754ec6a7518a3.tar.gz pyramid-516729ac8976a6e9ab3c43cef7b754ec6a7518a3.tar.bz2 pyramid-516729ac8976a6e9ab3c43cef7b754ec6a7518a3.zip | |
Minor tweaks.
| -rw-r--r-- | repoze/bfg/testing.py | 17 | ||||
| -rw-r--r-- | 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') |
