diff options
| author | Chris McDonough <chrism@plope.com> | 2010-11-22 15:21:57 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2010-11-22 15:21:57 -0500 |
| commit | eba45fd998b68d72b6e11f5b0bfa86d0ab17ee43 (patch) | |
| tree | ef3b6da6b6e64bd2a0d411200ecab4b27a2412ef | |
| parent | b37e96b0c944cc87d61dd499b33b01dc3c85a2d5 (diff) | |
| parent | c5f5572a5320ed0ddfc54ee4b03933b6280c9032 (diff) | |
| download | pyramid-eba45fd998b68d72b6e11f5b0bfa86d0ab17ee43.tar.gz pyramid-eba45fd998b68d72b6e11f5b0bfa86d0ab17ee43.tar.bz2 pyramid-eba45fd998b68d72b6e11f5b0bfa86d0ab17ee43.zip | |
Merge branch 'master' of github.com:Pylons/pyramid
| -rw-r--r-- | CHANGES.txt | 3 | ||||
| -rw-r--r-- | pyramid/testing.py | 23 |
2 files changed, 15 insertions, 11 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index ee36776c7..2ea0ac448 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,6 +10,9 @@ Features templates now use idiomatic SQLAlchemy configuration in their respective ``.ini`` files and Python code. +- ``pyramid.testig.DummyRequest`` now has a class variable, ``query_string``, + which defaults to the empty string. + Bug Fixes --------- diff --git a/pyramid/testing.py b/pyramid/testing.py index 4acede879..cc0ee5c5b 100644 --- a/pyramid/testing.py +++ b/pyramid/testing.py @@ -41,7 +41,7 @@ def registerDummySecurityPolicy(userid=None, groupids=(), permissive=True): argument. The authentication policy will return the userid identifier implied by the ``userid`` argument and the group ids implied by the ``groupids`` argument when the - :func:`pyramid.security.authenticated_userid` or + :func:`pyramid.security.authenticated_userid` or :func:`pyramid.security.effective_principals` APIs are used. This function is most useful when testing code that uses the APIs @@ -211,7 +211,7 @@ def registerAdapter(impl, for_=Interface, provides=Interface, name=''): The ``name`` argument is the empty string by default; it implies the name under which the adapter is registered. - + See `The ZCA book <http://www.muthukadan.net/docs/zca.html>`_ for more information about ZCA adapters. @@ -282,7 +282,7 @@ def registerSettings(dictarg=None, **kw): registerSettings({'external_uri':'http://example.com'}) Or a set of key/value pairs:: - + registerSettings(external_uri='http://example.com') Use of this function is required when you need to test code that calls @@ -361,7 +361,7 @@ class DummyTemplateRenderer(object): def implementation(self): return self._implementation - + def __call__(self, kw, system=None): if system: self._received.update(system) @@ -393,7 +393,7 @@ class DummyTemplateRenderer(object): raise AssertionError( 'A value for key "%s" was not passed to the renderer' % k) - + if myval != v: raise AssertionError( '\nasserted value for %s: %r\nactual value: %r' % ( @@ -431,7 +431,7 @@ class DummyModel: val.__name__ = name val.__parent__ = self self.subs[name] = val - + def __getitem__(self, name): """ Return a named subobject (see ``__setitem__``)""" ob = self.subs[name] @@ -465,7 +465,7 @@ class DummyModel: def __contains__(self, name): return name in self.subs - + def clone(self, __name__=_marker, __parent__=_marker, **kw): """ Create a clone of the model object. If ``__name__`` or ``__parent__`` arguments are passed, use these values to @@ -485,7 +485,7 @@ class DummyModel: class DummyRequest(object): """ A dummy request object (imitates a :term:`request` object). - + The ``params``, ``environ``, ``headers``, ``path``, and ``cookies`` arguments correspond to their :term`WebOb` equivalents. @@ -503,6 +503,7 @@ class DummyRequest(object): application_url = 'http://example.com' host = 'example.com:80' content_length = 0 + query_string = '' response_callbacks = () def __init__(self, params=None, environ=None, headers=None, path='/', cookies=None, post=None, **kw): @@ -721,8 +722,8 @@ class DummyRendererFactory(object): raise KeyError('No testing renderer registered for %r' % spec) return renderer - - + + class MockTemplate(object): def __init__(self, response): self._received = {} @@ -750,7 +751,7 @@ def skip_on(*platforms): return decorator skip_on.os_name = os.name # for testing try: # pragma: no cover - import __pypy__ + import __pypy__ skip_on.pypy = True except ImportError: skip_on.pypy = False |
