Function | admin_logged_in | Undocumented |
Function | anonymous_logged_in | Make a context manager for running with the anonymous log in. |
Function | celebrity_logged_in | Make a context manager for running logged in as a celebrity. |
Function | login | Simulates a login, using the specified email. |
Function | login_admin | Log in as an admin. |
Function | login_as | Login as a person or a team. |
Function | login_celebrity | Login as a celebrity. |
Function | login_person | Login the person with their preferred email. |
Function | login_team | Login as a member of 'team'. |
Function | logout | Tear down after login(...), ending the current interaction. |
Function | person_logged_in | Make a context manager for running logged in as 'person'. |
Function | run_with_login | Run 'function' with 'person' logged in. |
Function | with_celebrity_logged_in | Decorate a function so that it's run with a celebrity logged in. |
Function | with_person_logged_in | Undocumented |
Function | api_url | Find the web service URL of a data model object. |
Function | launchpadlib_credentials_for | Create launchpadlib credentials for the given person. |
Function | launchpadlib_for | Create a Launchpad object for the given person. |
Function | oauth_access_token_for | Find or create an OAuth access token for the given person. |
Function | reset_logging | Reset the logging system back to defaults |
Class | FakeTime | Provides a controllable implementation of time.time(). |
Class | StormStatementRecorder | A Storm tracer to record all database queries. |
Class | RequestTimelineCollector | Collect timeline events logged in web requests. |
Function | record_statements | Run the function and record the sql statements that are executed. |
Function | record_two_runs | A helper that returns the two storm statement recorders |
Function | run_with_storm_debug | A helper function to run a function with storm debug tracing on. |
Class | TestCase | Provide Launchpad-specific test facilities. |
Class | TestCaseWithFactory | No class docstring; 5/8 methods, 1/1 static methods documented |
Class | BrowserTestCase | A TestCase class for browser tests. |
Class | WebServiceTestCase | Test case optimized for testing the web service using launchpadlib. |
Class | AbstractYUITestCase | No class docstring; 3/4 methods documented |
Class | YUIUnitTestCase | Undocumented |
Function | build_yui_unittest_suite | Undocumented |
Class | ZopeTestInSubProcess | Run tests in a sub-process, respecting Zope idiosyncrasies. |
Class | EventRecorder | Intercept and record Zope events. |
Function | feature_flags | Provide a context in which feature flags work. |
Function | time_counter | A generator for yielding datetime values. |
Function | run_script | Run the given command line as a subprocess. |
Function | run_process | Run the given command as a subprocess. |
Function | normalize_whitespace | Replace all sequences of whitespace with a single space. |
Function | map_branch_contents | Return all files in branch at branch_url . |
Function | set_feature_flag | Set a feature flag to the specified value. |
Function | validate_mock_class | Validate method signatures in mock classes derived from real classes. |
Function | ws_object | Convert an object into its webservice version. |
Function | monkey_patch | In the ContextManager scope, monkey-patch values. |
Function | unlink_source_packages | Remove all links between the product and source packages. |
Class | ExpectedException | An ExpectedException that provides access to the caught exception. |
Function | extract_lp_cache | Undocumented |
Function | nonblocking_readline | Non-blocking readline. |
Class | FakeLaunchpadRequest | No class docstring; 1/1 methods documented |
Class | FakeAdapterMixin | A testcase mixin that helps register/unregister Zope adapters. |
Function | clean_up_reactor | Undocumented |
Function | verifyObject | A specialized verifyObject which removes the security proxy of the |
Function | _harvest_yui_test_files | Undocumented |
If the lp.testing.ANONYMOUS constant is supplied as the email, you'll be logged in as the anonymous user.
You can optionally pass in a participation to be used. If no participation is given, a LaunchpadTestRequest is used.
If the participation provides IPublicationRequest, it must implement setPrincipal(), otherwise it must allow setting its principal attribute.
Parameters | person_or_team | A person, a team, ANONYMOUS or None. None and ANONYMOUS are equivalent, and will log the person in as the anonymous user. |
Note that this is done automatically in LaunchpadFunctionalTestCase's tearDown method so you generally won't need to call this.
Parameters | person | A person, an account, a team or ANONYMOUS. If a team, will log in as an arbitrary member of that team. |
This makes it easy to load up the factory object you just created in launchpadlib.
Parameters | Which web service version to use. | |
Returns | A relative URL suitable for passing into Launchpad.load(). |
Parameters | consumer_name | An OAuth consumer name. |
person | A person (or the name of a person) for whom to create or find credentials. | |
permission | An OAuthPermission (or its token) designating the level of permission the credentials should have. | |
context | The OAuth context for the credentials. | |
Returns | A launchpadlib Credentials object. |
Parameters | consumer_name | An OAuth consumer name. |
person | A person (or the name of a person) for whom to create or find credentials. | |
permission | An OAuthPermission (or its token) designating the level of permission the credentials should have. | |
context | The OAuth context for the credentials. | |
version | The version of the web service to access. | |
service_root | The root URL of the web service to access. | |
Returns | A launchpadlib Launchpad object. |
Find or create an OAuth access token for the given person. :param consumer_name: An OAuth consumer name. :param person: A person (or the name of a person) for whom to create or find credentials. :param permission: An OAuthPermission (or its token) designating the level of permission the credentials should have. :param context: The OAuth context for the credentials (or a string designating same). :return: A tuple of an OAuthAccessToken object and its secret.
Currently, defaults means 'the way the Z3 testrunner sets it up' plus customizations made in lp_sitecustomize
Returns | a tuple containing the return value of the function, and a list of sql statements. |
If {login_method} is not None, it is called before each batch of {item_creator} calls.
If {record_request} is True, RequestTimelineCollector
is used to get
the query counts, so {tested_method} should make a web request.
Otherwise, StormStatementRecorder
is used to get the query count.
Returns | a tuple containing the two recorders obtained by the successive runs. |
A generator for yielding datetime values.
Each time the generator yields a value, the origin is incremented by the delta.
>>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1)) >>> now.next() datetime.datetime(2007, 12, 1, 0, 0) >>> now.next() datetime.datetime(2007, 12, 2, 0, 0) >>> now.next() datetime.datetime(2007, 12, 3, 0, 0)
Parameters | cmd_line | A command line suitable for passing to
subprocess.Popen . |
env | An optional environment dict. If none is given, the script will get a copy of your present environment. Either way, PYTHONPATH will be removed from it because it will break the script. | |
Returns | A 3-tuple of stdout, stderr, and the process' return code. |
This differs from run_script
in that it does not execute via a shell and
it explicitly connects stdin to /dev/null so that processes will not be
able to hang, waiting for user input.
Parameters | cmd_line | A command suitable for passing to subprocess.Popen . |
env | An optional environment dict. If none is given, the script will get a copy of your present environment. Either way, PYTHONPATH will be removed from it because it will break the script. | |
Returns | A 3-tuple of stdout, stderr, and the process' return code. |
branch_url
.Parameters | branch_url | the URL for an accessible branch. |
Returns | a dict mapping file paths to file contents. Only regular files are included. |
In order to access the flag, use the feature_flags context manager or set the feature controller in some other way. :param name: The name of the flag. :param value: The value of the flag. :param scope: The scope in which the specified value applies.
Validate method signatures in mock classes derived from real classes.
We often use mock classes in tests which are derived from real classes.
This function ensures that methods redefined in the mock class have the same signature as the corresponding methods of the base class.
>>> class A: ... ... def method_one(self, a): ... pass
>>> >>> class B(A): ... def method_one(self, a): ... pass >>> validate_mock_class(B)
If a class derived from A defines method_one with a different signature, we get an AssertionError.
>>> class C(A): ... def method_one(self, a, b): ... pass >>> validate_mock_class(C) Traceback (most recent call last): ... AssertionError: Different method signature for method_one:...
Even a parameter name must not be modified.
>>> class D(A): ... def method_one(self, b): ... pass >>> validate_mock_class(D) Traceback (most recent call last): ... AssertionError: Different method signature for method_one:...
If validate_mock_class() for anything but a class, we get an AssertionError.
>>> validate_mock_class('a string') Traceback (most recent call last): ... AssertionError: validate_mock_class() must be called for a class
Parameters | launchpad | The Launchpad instance to convert from. |
obj | The object to convert. | |
Returns | A launchpadlib Entry object. |
The context may be anything that supports setattr. Packages, modules, objects, etc. The kwargs are the name/value pairs for the values to set.
A product cannot be deactivated if it is linked to source packages.