reviewboard.testing.hosting_services¶
- class TestService(account)[source]¶
-
- authorize(username, password, hosting_url, local_site_name=None, two_factor_auth_code=None, *args, **kwargs)[source]¶
Authorize an account for the hosting service.
- Parameters
username (unicode) – The username for the account.
password (unicode) – The password for the account.
hosting_url (unicode) – The hosting URL for the service, if self-hosted.
credentials (dict) – All credentials provided by the authentication form. This will contain the username, password, and anything else provided by that form.
two_factor_auth_code (unicode, optional) – The two-factor authentication code provided by the user.
local_site_name (unicode, optional) – The Local Site name, if any, that the account should be bound to.
*args (tuple) – Extra unused positional arguments.
**kwargs (dict) – Extra keyword arguments containing values from the repository’s configuration.
- Raises
reviewboard.hostingsvcs.errors.AuthorizationError – The credentials provided were not valid.
reviewboard.hostingsvcs.errors.TwoFactorAuthCodeRequiredError – A two-factor authentication code is required to authorize this account. The request must be retried with the same credentials and with the
two_factor_auth_code
parameter provided.
- is_authorized()[source]¶
Return whether or not the account is currently authorized.
An account may no longer be authorized if the hosting service switches to a new API that doesn’t match the current authorization records. This function will determine whether the account is still considered authorized.
- Returns
Whether or not the associated account is authorized.
- Return type
- check_repository(test_repo_name, *args, **kwargs)[source]¶
Checks the validity of a repository configuration.
This performs a check against the hosting service or repository to ensure that the information provided by the user represents a valid repository.
This is passed in the repository details, such as the path and raw credentials, as well as the SCMTool class being used, the LocalSite’s name (if any), and all field data from the HostingServiceForm as keyword arguments.
- Parameters
path (unicode) – The repository URL.
username (unicode) – The username to use.
password (unicode) – The password to use.
scmtool_class (type) – The subclass of
SCMTool
that should be used.local_site_name (unicode) – The name of the local site associated with the repository, or
None
.*args (tuple) – Additional positional arguments, unique to each hosting service.
**kwargs (dict) – Additional keyword arguments, unique to each hosting service.
- Raises
reviewboard.hostingsvcs.errors.RepositoryError – The repository is not valid.