Jump to >

reviewboard.testing.hosting_services

class TestServiceForm(*args, **kwargs)[source]

Bases: reviewboard.hostingsvcs.forms.HostingServiceForm

__annotations__ = {}
declared_fields = {'test_repo_name': <django.forms.fields.CharField object>}
class TestService(account)[source]

Bases: reviewboard.hostingsvcs.service.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.

name = 'Test Service'[source]
form[source]

alias of reviewboard.testing.hosting_services.TestServiceForm

needs_authorization = True[source]
supports_repositories = True[source]
supports_bug_trackers = True[source]
supports_two_factor_auth = True[source]
has_repository_hook_instructions = True[source]
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
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

bool

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.

__annotations__ = {}
class SelfHostedTestService(account)[source]

Bases: reviewboard.testing.hosting_services.TestService

hosting_service_id = 'self_hosted_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.

name = 'Self-Hosted Test'[source]
self_hosted = True[source]
bug_tracker_field = '%(hosting_url)s/%(test_repo_name)s/issue/%%s'[source]
repository_fields = {'Git': {'mirror_path': 'git@%(hosting_domain)s:%(test_repo_name)s/', 'path': '%(hosting_url)s/%(test_repo_name)s/'}, 'Test': {'mirror_path': 'git@%(hosting_domain)s:%(test_repo_name)s/', 'path': '%(hosting_url)s/%(test_repo_name)s/'}}[source]
__annotations__ = {}