reviewboard.webapi.testing.queries¶
Testing utilities for API unit tests.
New in version 5.0.7.
- get_webapi_token_equeries(*, user: User, webapi_token: WebAPIToken) List[Union[ExpectedQuery, Dict[str, Any]]] [source]¶
Return expected queries for fetching API tokens for a user.
New in version 5.0.7.
- Parameters:
user (
django.contrib.auth.models.User
) – The user that owns the API token.webapi_token (
reviewboard.webapi.models.WebAPIToken
) – The API token being fetched.
- Returns:
The list of expected queries.
- Return type:
- get_webapi_request_start_equeries(*, user: Union[AnonymousUser, User], local_site: Optional[LocalSite] = None, webapi_token: Optional[WebAPIToken] = None, oauth2_access_token: Optional[AccessToken] = None, oauth2_application: Optional[Application] = None) ExpectedQueries [source]¶
Return expected queries for the start of an API HTTP request.
New in version 5.0.7.
- Parameters:
user (
django.contrib.auth.models.AnonymousUser
or :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:``django.contrib.auth.models.User
) – The user that’s checked for access.local_site (
reviewboard.site.models.LocalSite
, optional) – The optional Local Site value used in the queries.checks_local_site_access (
bool
, optional) – Whether the requested view uses thecheck_local_site_access()
decorator.
- Returns:
The list of expected queries.
- Return type:
- get_webapi_response_start_equeries(*, model: Type[Model], items_q_result: ExpectedQResult, items_distinct: bool = False, items_select_related: Set[str] = {}) ExpectedQueries [source]¶
Return expected queries for the start of an API payload response.
New in version 5.0.7.
- Parameters:
model (
type
) – The type of model backing the resource.items_q_result (
dict
) – An expected Q result representing the queries for items and item counts.items_distinct (
bool
, optional) – Whether the items query is expected to be distinct.items_select_related (
set
ofstr
, optional) – Any models that are select-related for this query.
- Returns:
The list of expected queries.
- Return type: