l.t.factory : module documentation

Part of lp.testing

Testing infrastructure for the Launchpad application.

This module should not contain tests (but it should be tested).

Function default_master_store Decorator to temporarily set the default Store to the master.
Class GPGSigningContext A helper object to hold the key, password and mode.
Class ObjectFactory Factory methods for creating basic Python objects.
Class BareLaunchpadObjectFactory Factory methods for creating Launchpad objects.
Function is_security_proxied_or_harmless Check that the object is security wrapped or a harmless object.
Class UnproxiedFactoryMethodWarning Raised when someone calls an unproxied factory method.
Class ShouldThisBeUsingRemoveSecurityProxy Raised when there is a potentially bad call to removeSecurityProxy.
Class LaunchpadObjectFactory A wrapper around BareLaunchpadObjectFactory.
Function remove_security_proxy_and_shout_at_engineer Remove an object's security proxy and print a warning.
def default_master_store(func):
Decorator to temporarily set the default Store to the master.

In some cases, such as in the middle of a page test story, we might be calling factory methods with the default Store set to the slave which breaks stuff. For instance, if we set an account's password that needs to happen on the master store and this is forced. However, if we then read it back the default Store has to be used.

def is_security_proxied_or_harmless(obj):
Check that the object is security wrapped or a harmless object.
def remove_security_proxy_and_shout_at_engineer(obj):
Remove an object's security proxy and print a warning.

A number of LaunchpadObjectFactory methods returned objects without a security proxy. This is now no longer possible, but a number of tests rely on unrestricted access to object attributes.

This function should only be used in legacy tests which fail because they expect unproxied objects.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.