reviewboard.reviews.testing.queries.review_groups¶
Testing utilities for building expected queries for review groups.
New in version 5.0.7.
- get_review_groups_accessible_q(*, user: Union[AnonymousUser, User], local_site: AnyOrAllLocalSites = None, visible_only: bool = True, has_view_invite_only_groups_perm: bool = False, needs_local_site_profile_query: bool = False, needs_user_permission_queries: bool = True, users_join_type: str = 'INNER JOIN') ExpectedQResult [source]¶
Return a Q expression for accessible review group queries.
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.visible_only (
bool
, optional) – Whether the query is limited to visible review groups.has_view_invite_only_groups_perm (
bool
, optional) –Whether to expect the
reviews.has_view_invite_only_groups_perm
permission to be set.Set to
True
if this is not cached at this point.needs_local_site_profile_query (
bool
, optional) –Whether the query should fetch a
LocalSiteProfile
.Set to
True
if this is not cached at this point.needs_user_permission_queries (
bool
, optional) –Whether the query should check for the
reviews.can_view_invite_only_groups
permission.Set to
False
if this is already cached at this point.users_join_type (
str
, optional) –The join type expected for any users relations.
This defaults to INNER JOIN, as that’s more likely in cases where this is being embedded in another query, outside of the manager’s own methods.
- Returns:
The expected Q results.
- Return type:
- get_review_groups_accessible_prep_equeries(*, user: Union[AnonymousUser, User], local_site: AnyOrAllLocalSites = None, needs_local_site_profile_query: bool = False, needs_user_permission_queries: bool = True) ExpectedQueries [source]¶
Return expected Group accessibility preparation queries.
These are queries that must be performed before the main accessibility query is executed.
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.needs_local_site_profile_query (
bool
, optional) –Whether the query should fetch a
LocalSiteProfile
.Set to
True
if this is not cached at this point.needs_user_permission_queries (
bool
, optional) –Whether the query should check for the
reviews.can_view_invite_only_groups
permission.Set to
False
if this is already cached at this point.
- Returns:
The list of expected queries.
- Return type:
- get_review_groups_accessible_equeries(*, user: Union[AnonymousUser, User], local_site: AnyOrAllLocalSites = None, visible_only: bool = True, has_view_invite_only_groups_perm: bool = False, needs_local_site_profile_query: bool = False, needs_user_permission_queries: bool = True) ExpectedQueries [source]¶
Return Group accessibility preparation queries.
This corresponds to a call from
Group.objects.accessible()
.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.visible_only (
bool
, optional) – Whether the queries are for visible groups only.has_view_invite_only_groups_perm (
bool
, optional) – Whether to expect thereviews.has_view_invite_only_groups_perm
permission to be set.needs_local_site_profile_query (
bool
, optional) –Whether the query should fetch a
LocalSiteProfile
.Set to
False
if this should be cached at this point.needs_user_permission_queries (
bool
, optional) –Whether the query should check for the
reviews.can_view_invite_only_groups
permission.Set to
False
if this is already cached at this point.
- Returns:
The list of expected queries.
- Return type:
- get_review_groups_accessible_ids_equeries(*, user: Union[AnonymousUser, User], local_site: AnyOrAllLocalSites = None, visible_only: bool = True, has_view_invite_only_groups_perm: bool = False, needs_local_site_profile_query: bool = False, needs_user_permission_queries: bool = True) ExpectedQueries [source]¶
Return expected queries for Group.objects.accessible_ids().
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.visible_only (
bool
, optional) – Whether the queries are for visible groups only.has_view_invite_only_groups_perm (
bool
, optional) – Whether to expect thereviews.has_view_invite_only_groups_perm
permission to be set.needs_local_site_profile_query (
bool
, optional) –Whether the query should fetch a
LocalSiteProfile
.Set to
False
if this should be cached at this point.needs_user_permission_queries (
bool
, optional) –Whether the query should check for the
reviews.can_view_invite_only_groups
permission.Set to
False
if this is already cached at this point.
- Returns:
The list of expected queries.
- Return type: