l.t.FakeAdapterMixin : class documentation

Part of lp.testing View In Hierarchy

Known subclasses: lp.app.browser.tests.test_formatters.ObjectFormatterAPITestCase, lp.app.browser.tests.test_page_macro.TestPageMacroDispatcherMixin, lp.app.tests.test_services.TestServiceFactory, lp.registry.browser.tests.test_commercialsubscription.PersonVouchersViewTestCase, lp.scripts.tests.test_garbo.TestGarbo

A testcase mixin that helps register/unregister Zope adapters.

These helper methods simplify the task to registering Zope adapters during the setup of a test and they will be unregistered when the test completes.

Method registerAdapter Register an adapter from the required interfacs to the provided.
Method registerAuthorizationAdapter Register a security checker to test authorisation.
Method registerBrowserViewAdapter Register a security checker to test authorization.
Method getAdapter Undocumented
Method registerUtility Undocumented
def registerAdapter(self, adapter_class, for_interfaces, provided_interface, name=None):

Register an adapter from the required interfacs to the provided.

eg. registerAdapter(
TestOtherThing, (IThing, ILayer), IOther, name='fnord')
def registerAuthorizationAdapter(self, authorization_class, for_interface, permission_name):

Register a security checker to test authorisation.

eg. registerAuthorizationAdapter(
TestChecker, IPerson, 'launchpad.View')
def registerBrowserViewAdapter(self, view_class, for_interface, name):
Register a security checker to test authorization.

eg registerBrowserViewAdapter(TestView, IPerson, '+test-view')

def getAdapter(self, for_interfaces, provided_interface, name=None):
Undocumented
def registerUtility(self, component, for_interface, name=''):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2019-12-10 00:00:19.