reviewboard.testing.hosting_services¶
- class TestServiceForm(*args, **kwargs)[source]¶
Bases:
HostingServiceForm
- declared_fields = {'test_repo_name': <django.forms.fields.CharField object>}¶
- class TestService(account)[source]¶
Bases:
HostingService
- hosting_service_id = 'test'[source]¶
The unique ID of the hosting service.
This should be lowercase, and only consist of the characters a-z, 0-9,
_
, and-
.New in version 3.0.16: This should now be set on all custom hosting services. It will be required in Review Board 4.0.
- form[source]¶
alias of
TestServiceForm
- supported_scmtools = ['Git', 'Test', 'perforce'][source]¶
A list of SCMTools IDs or names that are supported by this service.
This should contain a list of SCMTool IDs that this service can work with. For backwards-compatibility, it may instead contain a list of SCMTool names (corresponding to database registration names).
This may also be specified per-plan in the
plans
.Changed in version 3.0.16: Added support for SCMTool IDs. A future version will deprecate using SCMTool names here.
- visible_scmtools = ['git', 'test'][source]¶
A list of SCMTool IDs that are visible when configuring the service.
This should contain a list of SCMTool IDs that this service will show when configuring a repository. It can be used to offer continued legacy support for an SCMTool without offering it when creating new repositories. If not specified, all SCMTools listed in
supported_scmtools
are assumed to be visible.If explicitly set, this should always be equal to or a subset of
supported_scmtools
.This may also be specified per-plan in the
plans
.New in version 3.0.17.
- bug_tracker_field = 'http://example.com/%(hosting_account_username)s/%(test_repo_name)s/issue/%%s'[source]¶
- repository_fields = {'Git': {'path': 'http://example.com/%(test_repo_name)s/'}, 'Perforce': {'path': '%(test_repo_name).p4.example.com:1666'}, 'Test': {'path': 'http://example.com/%(test_repo_name)s/'}}[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 ofSCMTool
that should be used.local_site_name (
unicode
) – The name of the local site associated with the repository, orNone
.*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.
- class SelfHostedTestService(account)[source]¶
Bases:
TestService