reviewboard.reviews.testing.queries.reviews¶
Testing utilities for building expected queries for reviews.
New in version 5.0.7.
- get_reviews_accessible_q(*, user: Union[AnonymousUser, User], local_site: AnyOrAllLocalSites = None, has_local_sites_in_db: bool = False, filter_private: bool = False, status: Optional[str] = None, public: Optional[bool] = None, base_reply_to: Optional[Review] = None, extra_query: Q = <Q: (AND: )>, accessible_repository_ids: Sequence[int] = [], accessible_review_group_ids: Sequence[int] = [], has_view_invite_only_groups_perm: bool = False, needs_local_site_profile_query: bool = False) ExpectedQResult[source]¶
Return a Q expression for accessible review queries.
New in version 5.0.7.
- Parameters:
user (
django.contrib.auth.models.AnonymousUseror :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.has_local_sites_in_db (
bool, optional) – Whether the query expects Local Sites to be in the database.filter_private (
bool, optional) – Whether review requests would be filtered using ACL checks.status (
str, optional) – The optional status that would be used in the query.public (
bool, optional) – The optional public state to match in queries.base_reply_to (
reviewboard.reviews.models.review.Review, optional) – Any review that this results would be in reply to.extra_query (
django.db.models.Q, optional) – An extra query filter that would be included.accessible_repository_ids (
listofint, optional) – A list of accessible repository IDs that would be expected in the query.accessible_review_group_ids (
listofint, optional) – A list of accessible review group IDs that would be expected in the query.needs_local_site_profile_query (
bool, optional) –Whether the query should fetch a
LocalSiteProfile.Set this to
Falseif this should be cached at this point.
- Returns:
The expected Q results.
- Return type:
- get_reviews_from_user_q(*, from_user: Union[str, User], **kwargs: Unpack[_AccessibleKwargs]) ExpectedQResult[source]¶
Return a Q expression for accessible reviews from a user.
This corresponds to a call from
ReviewRequest.objects.from_user().New in version 5.0.7.
- Parameters:
from_user (
strordjango.contrib.auth.models.User) – The username or user that the reviews will be from.**kwargs (
dict, optional) – Keyword arguments to pass toget_reviews_accessible_q().
- Returns:
The list of expected queries.
- Return type:
- get_reviews_accessible_equeries(*, distinct: bool = False, **kwargs: Unpack[_AccessibleKwargs]) ExpectedQueries[source]¶
Return queries for accessible reviews.
This corresponds to a call from
ReviewRequest.objects.accessible().New in version 5.0.7.
- Parameters:
distinct (
bool, optional) – Whether this is a distinct query.**kwargs (
dict, optional) – Keyword arguments to pass toget_reviews_accessible_q().
- Returns:
The list of expected queries.
- Return type:
- get_reviews_from_user_equeries(*, from_user: Union[str, User], **kwargs: Unpack[_AccessibleKwargs]) ExpectedQueries[source]¶
Return queries for accessible reviews from a user.
This corresponds to a call from
ReviewRequest.objects.from_user().New in version 5.0.7.
- Parameters:
from_user (
strordjango.contrib.auth.models.User) – The username or user that the reviews will be from.**kwargs (
dict, optional) – Keyword arguments to pass toget_reviews_from_user_q().
- Returns:
The list of expected queries.
- Return type: