| | |
| | | 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 |
| | |
| | | |
| | | 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. |
| | | |
| | |
| | | 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 |
| | |
| | | |
| | | def implementation(self): |
| | | return self._implementation |
| | | |
| | | |
| | | def __call__(self, kw, system=None): |
| | | if system: |
| | | self._received.update(system) |
| | |
| | | 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' % ( |
| | |
| | | val.__name__ = name |
| | | val.__parent__ = self |
| | | self.subs[name] = val |
| | | |
| | | |
| | | def __getitem__(self, name): |
| | | """ Return a named subobject (see ``__setitem__``)""" |
| | | ob = self.subs[name] |
| | |
| | | |
| | | 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 |
| | |
| | | |
| | | 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. |
| | |
| | | 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): |
| | |
| | | raise KeyError('No testing renderer registered for %r' % |
| | | spec) |
| | | return renderer |
| | | |
| | | |
| | | |
| | | |
| | | class MockTemplate(object): |
| | | def __init__(self, response): |
| | | self._received = {} |
| | |
| | | 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 |