repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
saleor | saleor/graphql/warehouse/tests/bulk_mutations/test_stock_bulk_update.py | .py | from unittest.mock import patch
import graphene
from .....warehouse.error_codes import StockBulkUpdateErrorCode
from ....tests.utils import get_graphql_content
STOCKS_BULK_UPDATE_MUTATION = """
mutation StockBulkUpdate($stocks: [StockBulkUpdateInput!]!){
stockBulkUpdate(stocks: $stocks){
resu... | 494 | 15,293 |
saleor | saleor/graphql/warehouse/tests/benchmark/test_stock_bulk_update.py | .py | import pytest
from django.db import connection
from .....warehouse.models import Stock
from ....tests.utils import get_graphql_content
STOCKS_BULK_UPDATE_MUTATION = """
mutation StockBulkUpdate($stocks: [StockBulkUpdateInput!]!){
stockBulkUpdate(stocks: $stocks){
results{
error... | 129 | 3,915 |
saleor | saleor/graphql/warehouse/tests/benchmark/test_stocks.py | .py | import pytest
from .....warehouse.models import Stock, Warehouse
from ....tests.utils import get_graphql_content
@pytest.fixture
def stocks(address, variant):
warehouses = Warehouse.objects.bulk_create(
[
Warehouse(
address=address.get_copy(),
name=f"Warehouse ... | 59 | 1,180 |
saleor | saleor/graphql/warehouse/tests/queries/test_warehouse.py | .py | import graphene
from ....core.utils import from_global_id_or_error
from ....tests.utils import (
assert_no_permission,
get_graphql_content,
get_graphql_content_from_response,
)
QUERY_WAREHOUSE = """
query warehouse($id: ID!){
warehouse(id: $id) {
id
name
companyName
ema... | 296 | 8,669 |
saleor | saleor/graphql/warehouse/tests/queries/test_warehouses.py | .py | import graphene
from .....warehouse.models import Warehouse
from ....tests.utils import assert_no_permission, get_graphql_content
QUERY_WAREHOUSES = """
query {
warehouses(first:100) {
totalCount
edges {
node {
id
name
companyName
... | 125 | 3,687 |
saleor | saleor/graphql/warehouse/tests/queries/test_warehouses_pagination.py | .py | import graphene
import pytest
from .....warehouse.models import Warehouse
from ....tests.utils import get_graphql_content
@pytest.fixture
def warehouses_for_pagination(db, address):
return Warehouse.objects.bulk_create(
[
Warehouse(
name="Warehouse1",
address=a... | 167 | 4,673 |
saleor | saleor/graphql/warehouse/tests/queries/test_stocks_filtering.py | .py | from .....warehouse.models import Stock
from ....tests.utils import get_graphql_content
QUERY_STOCKS_WITH_FILTERS = """
query stocks($filter: StockFilterInput!) {
stocks(first: 100, filter: $filter) {
totalCount
edges {
node {
id
}... | 105 | 3,199 |
saleor | saleor/graphql/warehouse/tests/queries/test_warehouses_filtering.py | .py | import graphene
import pytest
from .....warehouse import WarehouseClickAndCollectOption
from .....warehouse.models import Warehouse
from ....tests.utils import get_graphql_content
QUERY_WAREHOUSES_WITH_FILTERS = """
query Warehouses($filters: WarehouseFilterInput) {
warehouses(first:100, filter: $filters) {
... | 337 | 10,288 |
saleor | saleor/graphql/warehouse/tests/queries/test_stock.py | .py | import datetime
import graphene
from django.utils import timezone
from .....permission.enums import ProductPermissions
from .....warehouse.models import Reservation
from .....warehouse.tests.utils import get_quantity_allocated_for_stock
from ....tests.utils import (
assert_no_permission,
get_graphql_content,
... | 177 | 5,505 |
saleor | saleor/graphql/warehouse/tests/queries/test_stocks.py | .py | from .....permission.enums import ProductPermissions
from .....warehouse.models import Stock
from ....tests.utils import assert_no_permission, get_graphql_content
QUERY_STOCKS = """
query {
stocks(first:100) {
totalCount
edges {
node {
id
... | 52 | 1,367 |
saleor | saleor/graphql/warehouse/tests/mutations/test_warehouse_shipping_zone_assign.py | .py | import graphene
from .....warehouse.error_codes import WarehouseErrorCode
from ....tests.utils import get_graphql_content
MUTATION_ASSIGN_SHIPPING_ZONE_WAREHOUSE = """
mutation assignWarehouseShippingZone($id: ID!, $shippingZoneIds: [ID!]!) {
assignWarehouseShippingZone(id: $id, shippingZoneIds: $shippingZoneIds) {... | 184 | 5,618 |
saleor | saleor/graphql/warehouse/tests/mutations/test_warehouse_delete.py | .py | import json
from unittest.mock import patch
import graphene
from django.utils.functional import SimpleLazyObject
from .....account.models import Address
from .....core.utils.json_serializer import CustomJsonEncoder
from .....warehouse import WarehouseClickAndCollectOption
from .....warehouse.models import Stock, Ware... | 354 | 10,958 |
saleor | saleor/graphql/warehouse/tests/mutations/test_warehouse_create.py | .py | import json
from unittest.mock import patch
import graphene
import pytest
from django.utils.functional import SimpleLazyObject
from .....account.i18n_valid_address_extension import VALID_ADDRESS_EXTENSION_MAP
from .....account.models import Address
from .....core.utils.json_serializer import CustomJsonEncoder
from ..... | 429 | 12,936 |
saleor | saleor/graphql/warehouse/tests/mutations/test_warehouse_update.py | .py | import json
from unittest.mock import patch
import graphene
import pytest
from django.utils.functional import SimpleLazyObject
from .....core.utils.json_serializer import CustomJsonEncoder
from .....warehouse import WarehouseClickAndCollectOption
from .....warehouse.error_codes import WarehouseErrorCode
from .....war... | 620 | 18,311 |
saleor | saleor/graphql/warehouse/tests/mutations/test_warehouse_shipping_zone_unassign.py | .py | import graphene
MUTATION_UNASSIGN_SHIPPING_ZONE_WAREHOUSE = """
mutation unassignWarehouseShippingZone($id: ID!, $shippingZoneIds: [ID!]!) {
unassignWarehouseShippingZone(id: $id, shippingZoneIds: $shippingZoneIds) {
errors {
field
message
code
}
}
}
"""
def test_shipping_zone_unassign... | 39 | 1,025 |
saleor | saleor/graphql/warehouse/mutations/warehouse_delete.py | .py | import graphene
from ....core.tracing import traced_atomic_transaction
from ....core.utils.events import call_event
from ....permission.enums import ProductPermissions
from ....warehouse import models
from ....warehouse.channel_stock_availability import (
get_source_warehouses_data,
trigger_out_of_stock_in_cha... | 135 | 5,380 |
saleor | saleor/graphql/warehouse/mutations/__init__.py | .py | from .warehouse_create import WarehouseCreate
from .warehouse_delete import WarehouseDelete
from .warehouse_shipping_zone_assign import WarehouseShippingZoneAssign
from .warehouse_shipping_zone_unassign import WarehouseShippingZoneUnassign
from .warehouse_update import WarehouseUpdate
__all__ = [
"WarehouseCreate"... | 14 | 442 |
saleor | saleor/graphql/warehouse/mutations/warehouse_shipping_zone_assign.py | .py | from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from ....channel import models as channel_models
from ....permission.enums import ProductPermissions
from ....warehouse import models
from ....warehouse.error_codes import WarehouseErrorCode
from ....warehouse.valid... | 123 | 4,859 |
saleor | saleor/graphql/warehouse/mutations/warehouse_shipping_zone_unassign.py | .py | import graphene
from ....permission.enums import ProductPermissions
from ....warehouse import models
from ...account.i18n import I18nMixin
from ...core import ResolveInfo
from ...core.mutations import DeprecatedModelMutation
from ...core.types import NonNullList, WarehouseError
from ...shipping.types import ShippingZo... | 41 | 1,546 |
saleor | saleor/graphql/warehouse/mutations/warehouse_create.py | .py | from ....permission.enums import ProductPermissions
from ....warehouse import models
from ...account.i18n import I18nMixin
from ...account.mixins import AddressMetadataMixin
from ...core import ResolveInfo
from ...core.mutations import DeprecatedModelMutation
from ...core.types import WarehouseError
from ...plugins.dat... | 52 | 2,022 |
saleor | saleor/graphql/warehouse/mutations/warehouse_update.py | .py | import graphene
from ....permission.enums import ProductPermissions
from ....warehouse import models
from ...account.i18n import I18nMixin
from ...account.mixins import AddressMetadataMixin
from ...core import ResolveInfo
from ...core.mutations import ModelWithExtRefMutation
from ...core.types import WarehouseError
fr... | 64 | 2,456 |
saleor | saleor/graphql/warehouse/mutations/base.py | .py | from django.core.exceptions import ValidationError
from ....warehouse import WarehouseClickAndCollectOption
from ....warehouse.error_codes import WarehouseErrorCode
from ...core import ResolveInfo
from ...core.validators import (
validate_required_string_field,
validate_slug_and_generate_if_needed,
)
class W... | 62 | 2,335 |
saleor | saleor/graphql/channel/types.py | .py | import collections
import itertools
from typing import TYPE_CHECKING
import graphene
from django_countries.fields import Country
from graphene.types.objecttype import ObjectType
from promise import Promise
from ...channel import models
from ...permission.auth_filters import AuthorizationFilters
from ...permission.enu... | 547 | 20,542 |
saleor | saleor/graphql/channel/utils.py | .py | from collections import defaultdict
from django.core.exceptions import ValidationError
from django.db.models import Exists, OuterRef, Q
from django.utils.functional import SimpleLazyObject
from graphql.error import GraphQLError
from ...channel.exceptions import ChannelNotDefined, NoDefaultChannel
from ...channel.mode... | 161 | 5,850 |
saleor | saleor/graphql/channel/resolvers.py | .py | from ...channel import models
from ...permission.auth_filters import is_app, is_staff_user
from ..core.context import get_database_connection_name
from ..core.utils import from_global_id_or_error
from ..core.validators import validate_one_of_args_is_in_query
from .types import Channel
def resolve_channel(info, id: st... | 37 | 1,116 |
saleor | saleor/graphql/channel/filters.py | .py | def get_channel_slug_from_filter_data(filter_data: dict):
channel = filter_data.get("channel")
return str(channel) if channel else None
def get_currency_from_filter_data(filter_data: dict):
currency = filter_data.get("currency")
return str(currency) if currency else None
| 9 | 290 |
saleor | saleor/graphql/channel/enums.py | .py | from typing import Final
import graphene
from ...channel import AllocationStrategy, MarkAsPaidStrategy, TransactionFlowStrategy
from ..core.descriptions import DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import (
DOC_CATEGORY_CHANNELS,
DOC_CATEGORY_PAYMENTS,
DOC_CATEGORY_PRODUCTS,
)
from ..core.en... | 42 | 1,277 |
saleor | saleor/graphql/channel/schema.py | .py | import graphene
from ...permission.auth_filters import AuthorizationFilters
from ..core import ResolveInfo
from ..core.doc_category import DOC_CATEGORY_CHANNELS
from ..core.fields import BaseField, PermissionsField
from ..core.types import NonNullList
from .mutations import (
ChannelActivate,
ChannelCreate,
... | 60 | 1,862 |
saleor | saleor/graphql/channel/tests/benchmark/test_channel.py | .py | import pytest
from ....tests.utils import get_graphql_content
CHANNELS_QUERY = """
query {
channels {
name
slug
currencyCode
warehouses {
id
}
defaultCountry {
code
country
}... | 37 | 776 |
saleor | saleor/graphql/channel/tests/queries/test_channel.py | .py | import graphene
from prices import Money
from .....channel import TransactionFlowStrategy
from .....shipping.models import ShippingMethodChannelListing, ShippingZone
from ....tests.utils import (
assert_no_permission,
get_graphql_content,
get_graphql_content_from_response,
)
from ...enums import Allocation... | 757 | 22,808 |
saleor | saleor/graphql/channel/tests/queries/test_channels.py | .py | from ....tests.utils import assert_no_permission, get_graphql_content
QUERY_CHANNELS = """
query {
channels {
name
slug
currencyCode
defaultCountry {
code
country
}
}
}
"""
def test_query_channels_as_s... | 150 | 3,715 |
saleor | saleor/graphql/channel/tests/dataloaders/test_by_transaction.py | .py | from .....channel.models import Channel
from ....context import SaleorContext
from ...dataloaders.by_transaction import ChannelByTransactionIdLoader
def test_batch_load_with_order_transactions(
order_with_lines, transaction_item_generator
):
# given
order = order_with_lines
transaction1 = transaction_... | 180 | 5,663 |
saleor | saleor/graphql/channel/tests/mutations/test_base_channel_listing.py | .py | from collections import defaultdict
import graphene
import pytest
from django.core.exceptions import ValidationError
from .....shipping.error_codes import ShippingErrorCode
from ...mutations import BaseChannelListingMutation
def test_validate_duplicated_channel_ids(channel_PLN, channel_USD):
# given
channel... | 167 | 5,101 |
saleor | saleor/graphql/channel/tests/mutations/test_channel_create.py | .py | import datetime
import json
from unittest import mock
import graphene
import pytest
from django.conf import settings
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
from django.utils.text import slugify
from freezegun import freeze_time
from .....channel.error_codes import Chann... | 1,593 | 46,561 |
saleor | saleor/graphql/channel/tests/mutations/test_channel_reorder_warehouses.py | .py | import uuid
import graphene
import pytest
from .....channel.error_codes import ChannelErrorCode
from .....warehouse.models import ChannelWarehouse
from ....tests.utils import get_graphql_content
CHANNEL_REORDER_WAREHOUSES = """
mutation ChannelReorderWarehouses($channelId: ID!, $moves: [ReorderInput!]!) {
... | 195 | 5,703 |
saleor | saleor/graphql/channel/tests/mutations/test_channel_deactivate.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....channel.error_codes import ChannelErrorCode
from .....core.utils.json_serializer import CustomJsonEncoder
from .....webhook.event_types import WebhookEventAsyncType
fr... | 125 | 3,682 |
saleor | saleor/graphql/channel/tests/mutations/test_channel_activate.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....channel.error_codes import ChannelErrorCode
from .....core.utils.json_serializer import CustomJsonEncoder
from .....webhook.event_types import WebhookEventAsyncType
fr... | 127 | 3,711 |
saleor | saleor/graphql/channel/tests/mutations/test_channel_update.py | .py | import datetime
import json
from unittest.mock import call, patch
import graphene
import pytest
from django.conf import settings
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
from django.utils.text import slugify
from freezegun import freeze_time
from .....channel.error_codes ... | 2,653 | 82,321 |
saleor | saleor/graphql/channel/tests/mutations/test_channel_delete.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....channel.error_codes import ChannelErrorCode
from .....channel.models import Channel
from .....checkout.models import Checkout
from .....core.utils.json_serializer impo... | 379 | 11,997 |
saleor | saleor/graphql/channel/dataloaders/by_transaction.py | .py | from collections.abc import Iterable
from promise import Promise
from ....channel.models import Channel
from ....payment.models import TransactionItem
from ...core.dataloaders import DataLoader
from .by_checkout import ChannelByCheckoutIDLoader
from .by_order import ChannelByOrderIdLoader
class ChannelByTransaction... | 71 | 2,437 |
saleor | saleor/graphql/channel/dataloaders/by_checkout.py | .py | from uuid import UUID
from ....channel.models import Channel
from ...checkout.dataloaders import CheckoutByTokenLoader
from ...core.dataloaders import DataLoader
from .by_self import ChannelByIdLoader
class ChannelByCheckoutIDLoader(DataLoader[UUID, Channel]):
context_key = "channel_by_checkout"
def batch_l... | 29 | 997 |
saleor | saleor/graphql/channel/dataloaders/by_self.py | .py | from ....channel.models import Channel
from ...core.dataloaders import DataLoader
class ChannelByIdLoader(DataLoader[int, Channel]):
context_key = "channel_by_id"
def batch_load(self, keys):
channels = Channel.objects.using(self.database_connection_name).in_bulk(keys)
return [channels.get(cha... | 21 | 657 |
saleor | saleor/graphql/channel/dataloaders/by_order.py | .py | from uuid import UUID
from django.db.models import Exists, OuterRef
from ....channel.models import Channel
from ....order.models import Order
from ...core.dataloaders import DataLoader
from ...order.dataloaders import OrderByIdLoader
from .by_self import ChannelByIdLoader
class ChannelByOrderIdLoader(DataLoader[UUI... | 47 | 1,532 |
saleor | saleor/graphql/channel/mutations/utils.py | .py | import datetime
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils import timezone
from ....channel.models import Channel
from ...core.enums import ChannelErrorCode
CHANNEL_UPDATE_FIELDS = [
"name",
"slug",
"default_country",
"is_active",
"alloca... | 304 | 11,387 |
saleor | saleor/graphql/channel/mutations/channel_create.py | .py | import graphene
from django.conf import settings
from django.utils.text import slugify
from ....channel import models
from ....core.tracing import traced_atomic_transaction
from ....permission.enums import ChannelPermissions
from ....tax.models import TaxConfiguration
from ....webhook.event_types import WebhookEventAs... | 399 | 15,247 |
saleor | saleor/graphql/channel/mutations/__init__.py | .py | from .base_channel_listing import BaseChannelListingMutation
from .channel_activate import ChannelActivate
from .channel_create import ChannelCreate
from .channel_deactivate import ChannelDeactivate
from .channel_delete import ChannelDelete
from .channel_reorder_warehouses import ChannelReorderWarehouses
from .channel_... | 18 | 540 |
saleor | saleor/graphql/channel/mutations/channel_deactivate.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....channel.error_codes import ChannelErrorCode
from ....permission.enums import ChannelPermissions
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_CHANNELS
fr... | 56 | 2,078 |
saleor | saleor/graphql/channel/mutations/channel_activate.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....channel.error_codes import ChannelErrorCode
from ....permission.enums import ChannelPermissions
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_CHANNELS
fr... | 56 | 2,054 |
saleor | saleor/graphql/channel/mutations/base_channel_listing.py | .py | import datetime
from collections import defaultdict
from collections.abc import Iterable
from django.core.exceptions import ValidationError
from ....channel import models
from ....core.utils.date_time import convert_to_utc_date_time
from ...core import ResolveInfo
from ...core.mutations import BaseMutation
from ...co... | 135 | 4,855 |
saleor | saleor/graphql/channel/mutations/channel_update.py | .py | from typing import cast
import graphene
from django.core.exceptions import ValidationError
from django.utils.text import slugify
from ....channel import models
from ....channel.error_codes import ChannelErrorCode
from ....core.tracing import traced_atomic_transaction
from ....core.utils.update_mutation_manager import... | 322 | 12,769 |
saleor | saleor/graphql/channel/mutations/channel_delete.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....channel import models
from ....channel.error_codes import ChannelErrorCode
from ....checkout.models import Checkout
from ....core.tracing import traced_atomic_transaction
from ....order.models import Order
from ....permission.enums import Chan... | 152 | 6,050 |
saleor | saleor/graphql/channel/mutations/channel_reorder_warehouses.py | .py | from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from ....channel.error_codes import ChannelErrorCode
from ....core.tracing import traced_atomic_transaction
from ....permission.enums import ChannelPermissions
from ...core import ResolveInfo
from ...core.doc_catego... | 97 | 3,478 |
saleor | saleor/graphql/page/types.py | .py | import graphene
from ...attribute import models as attribute_models
from ...page import models
from ...permission.enums import PagePermissions, PageTypePermissions
from ...permission.utils import all_permissions_required
from ..attribute.dataloaders.assigned_attributes import (
AttributeByPageIdAndAttributeSlugLoa... | 331 | 12,057 |
saleor | saleor/graphql/page/bulk_mutations.py | .py | import graphene
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import transaction
from django.db.models import Exists, OuterRef
from ...attribute import AttributeInputType
from ...attribute import models as attribute_models
from ...attribute.lock_objects import attri... | 211 | 7,950 |
saleor | saleor/graphql/page/resolvers.py | .py | from ...channel.models import Channel
from ...page import models
from ..core.context import ChannelQsContext, get_database_connection_name
from ..core.utils import from_global_id_or_error
from ..core.validators import validate_one_of_args_is_in_query
from ..utils import get_user_or_app_from_context
from .types import P... | 69 | 2,363 |
saleor | saleor/graphql/page/filters.py | .py | import django_filters
import graphene
from django.db.models import Exists, OuterRef, Q, QuerySet
from ...attribute.models import (
AssignedPageAttributeValue,
AttributePage,
AttributeValue,
)
from ...page import models
from ..attribute.shared_filters import (
AssignedAttributeWhereInput,
filter_obj... | 169 | 5,022 |
saleor | saleor/graphql/page/schema.py | .py | import graphene
from ...core.search import prefix_search
from ..channel.dataloaders.by_self import ChannelBySlugLoader
from ..core import ResolveInfo
from ..core.connection import create_connection_slice, filter_connection_queryset
from ..core.context import ChannelContext, ChannelQsContext
from ..core.descriptions im... | 172 | 6,431 |
saleor | saleor/graphql/page/dataloaders.py | .py | from collections import defaultdict
from ...attribute.models import Attribute, AttributePage
from ...page.models import Page, PageType
from ..attribute.dataloaders.attributes import (
AttributesByAttributeId,
)
from ..core.dataloaders import DataLoader
PageTypeIdAndAttributeSlug = tuple[int, str]
class PageById... | 103 | 3,526 |
saleor | saleor/graphql/page/sorters.py | .py | from ..core.doc_category import DOC_CATEGORY_PAGES
from ..core.types import BaseEnum, SortInputObjectType
class PageSortField(BaseEnum):
TITLE = ["title", "slug"]
SLUG = ["slug"]
VISIBILITY = ["is_published", "title", "slug"]
CREATION_DATE = ["created_at", "title", "slug", "pk"]
PUBLICATION_DATE =... | 74 | 2,961 |
saleor | saleor/graphql/page/tests/benchmark/test_page_type.py | .py | import graphene
import pytest
from .....page.models import PageType
from ....tests.utils import get_graphql_content
@pytest.mark.django_db
@pytest.mark.count_queries(autouse=False)
def test_query_page_type(
page_type,
staff_api_client,
author_page_attribute,
permission_manage_pages,
permission_ma... | 204 | 6,251 |
saleor | saleor/graphql/page/tests/queries/test_page_type.py | .py | import graphene
import pytest
from ....tests.utils import (
assert_no_permission,
get_graphql_content,
get_graphql_content_from_response,
)
PAGE_TYPE_QUERY = """
query PageType(
$id: ID!, $filters: AttributeFilterInput, $where: AttributeWhereInput,
$search: String
) {
pageT... | 436 | 13,112 |
saleor | saleor/graphql/page/tests/queries/test_page_types_sorting_and_filtering.py | .py | import graphene
import pytest
from .....page.models import PageType
from ....tests.utils import get_graphql_content
PAGE_TYPES_QUERY = """
query PageTypes($filter: PageTypeFilterInput, $sortBy: PageTypeSortingInput) {
pageTypes(first: 10, filter: $filter, sortBy: $sortBy) {
edges {
... | 138 | 3,687 |
saleor | saleor/graphql/page/tests/queries/test_page.py | .py | import graphene
import pytest
from .....attribute.models import AttributeValue
from .....attribute.tests.model_helpers import (
get_page_attribute_values,
get_page_attributes,
)
from .....attribute.utils import associate_attribute_values_to_instance
from .....page.models import PageTranslation
from .....tests.... | 760 | 22,207 |
saleor | saleor/graphql/page/tests/queries/test_pages.py | .py | import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from .....page.models import Page
from .....tests.utils import dummy_editorjs
from ....tests.utils import get_graphql_content
QUERY_PAGES_WITH_FILTER = """
query ($filter: PageFilterInput) {
pages(first: 5, f... | 454 | 12,589 |
saleor | saleor/graphql/page/tests/queries/test_pages_search.py | .py | import graphene
import pytest
from .....attribute.utils import associate_attribute_values_to_instance
from .....page.models import Page
from .....page.search import update_pages_search_vector
from .....tests.utils import dummy_editorjs
from ....tests.utils import get_graphql_content
QUERY_PAGES_WITH_SEARCH = """
... | 407 | 11,517 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_unassigned_attribute.py | .py | import graphene
import pytest
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
PAGE_UNASSIGN_ATTR_MUTATION = """
mutation PageAttributeUnassign($pageTypeId: ID!, $attributeIds: [ID!]!) {
pageAttributeUnassign(
pageTypeId:... | 92 | 2,789 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_categories.py | .py | import graphene
import pytest
from ......attribute import AttributeEntityType, AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from .....core.utils import to_global_id_or_none
from .....tests.utils i... | 303 | 9,414 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_metadata.py | .py | import graphene
import pytest
from ......page.models import Page
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.parametrize(
("metadata", "expected_indexes"),
[
({"key": "foo"}, [0, 1]),
({"key": "foo", "value": {"eq": "bar"}}, [0]),
... | 59 | 1,587 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_collections.py | .py | import graphene
import pytest
from ......attribute import AttributeEntityType, AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from .....core.utils import to_global_id_or_none
from .....tests.utils i... | 309 | 9,882 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_attributes_numeric.py | .py | import pytest
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.parametrize(
("numeric_input", "expected_count"),
[
({"slug": "num-slug", "value": {"numeric": {"eq": 1.2}}},... | 88 | 2,912 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_slug.py | .py | import pytest
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.parametrize(
("where", "pages_count"),
[
({"slug": {"eq": "test-url-1"}}, 1),
({"slug": {"oneOf": ["test-url-1", "test-url-2"]}}, 2),
],
)
def test_pages_with_where_slug(... | 28 | 681 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_multiple_arguments.py | .py | import pytest
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.parametrize(
"attribute_filter",
[
# Non-existing attribute slug
[{"slug": "non-existing-attribute"}]... | 247 | 8,058 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_ids.py | .py | import graphene
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
def test_pages_query_with_where_by_ids(
staff_api_client, permission_manage_pages, page_list, page_list_unpublished
):
# given
query = QUERY_PAGES_WITH_WHERE
page_ids = [
graphene.Node... | 26 | 734 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/shared.py | .py | QUERY_PAGES_WITH_WHERE = """
query ($where: PageWhereInput) {
pages(first: 5, where:$where) {
totalCount
edges {
node {
id
}
}
}
}
"""
| 13 | 247 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_attributes_datetime.py | .py | import datetime
import pytest
from ......attribute import AttributeInputType, AttributeType
from ......attribute.models import Attribute
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.p... | 127 | 3,957 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_variants.py | .py | import graphene
import pytest
from ......attribute import AttributeEntityType, AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from .....core.utils import to_global_id_or_none
from .....tests.utils i... | 317 | 9,982 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_pages.py | .py | import pytest
from ......attribute import AttributeEntityType, AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from ......page.models import Page
from .....core.utils import to_global_id_or_none
from... | 334 | 10,546 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_attributes_boolean.py | .py | import graphene
import pytest
from ......attribute import AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
... | 82 | 2,578 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_validation.py | .py | import pytest
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.parametrize(
"attribute_value_filter",
[{"numeric": None}, {"name": None}, {"slug": None}, {"boolean": False}],
)
def test_pages_query_failed_filter_validation_for_numeric_with_slug_input(
... | 301 | 8,649 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_attributes.py | .py | import graphene
import pytest
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.parametrize(
("_case", "attributes_value"),
[
("empty_list", []),
("null", None),
... | 191 | 5,112 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_page_type.py | .py | import graphene
from ......page.models import Page, PageType
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
def test_pages_with_where_page_type_eq(staff_api_client, page_type_list):
# given
page = Page.objects.first()
assigned_page_type = page.page_type
pa... | 54 | 1,703 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_attributes_date.py | .py | import datetime
import pytest
from ......attribute import AttributeInputType, AttributeType
from ......attribute.models import Attribute
from ......attribute.utils import associate_attribute_values_to_instance
from .....tests.utils import get_graphql_content
from .shared import QUERY_PAGES_WITH_WHERE
@pytest.mark.p... | 101 | 3,087 |
saleor | saleor/graphql/page/tests/queries/pages_with_where/test_with_where_references_products.py | .py | import graphene
import pytest
from ......attribute import AttributeEntityType, AttributeInputType, AttributeType
from ......attribute.models import Attribute, AttributeValue
from ......attribute.utils import associate_attribute_values_to_instance
from .....core.utils import to_global_id_or_none
from .....tests.utils i... | 303 | 9,315 |
saleor | saleor/graphql/page/tests/deprecated/test_page_create.py | .py | import datetime
import graphene
from django.utils.text import slugify
from .....page.error_codes import PageErrorCode
from .....tests.utils import dummy_editorjs
from ....tests.utils import get_graphql_content
CREATE_PAGE_MUTATION = """
mutation CreatePage(
$input: PageCreateInput!
) {
pageCr... | 148 | 4,841 |
saleor | saleor/graphql/page/tests/deprecated/test_page_update.py | .py | import datetime
import graphene
from .....page.error_codes import PageErrorCode
from .....page.models import Page
from ....tests.utils import get_graphql_content
UPDATE_PAGE_MUTATION = """
mutation updatePage(
$id: ID!, $input: PageInput!
) {
pageUpdate(
id: $id, input: $input
... | 112 | 3,173 |
saleor | saleor/graphql/page/tests/deprecated/test_page_sorting.py | .py | import pytest
from django.utils import timezone
from freezegun import freeze_time
from .....page.models import Page
from .....tests.utils import dummy_editorjs
from ....tests.utils import get_graphql_content
QUERY_PAGE_WITH_SORT = """
query ($sort_by: PageSortingInput!) {
pages(first:5, sortBy: $sort_by) ... | 80 | 2,832 |
saleor | saleor/graphql/page/tests/mutations/test_page_create.py | .py | import datetime
from functools import partial
from unittest import mock
from unittest.mock import ANY
import graphene
from django.conf import settings
from django.utils.functional import SimpleLazyObject
from django.utils.text import slugify
from freezegun import freeze_time
from .....page.error_codes import PageErro... | 2,040 | 66,747 |
saleor | saleor/graphql/page/tests/mutations/test_page_update.py | .py | import datetime
from functools import partial
from unittest import mock
from unittest.mock import ANY
import graphene
import pytest
from django.conf import settings
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
from django.utils.text import slugify
from freezegun import freeze_... | 2,089 | 64,251 |
saleor | saleor/graphql/page/tests/mutations/test_page_attribute_unassign.py | .py | import graphene
from ....tests.utils import assert_no_permission, get_graphql_content
PAGE_UNASSIGN_ATTR_QUERY = """
mutation PageAttributeUnassign(
$pageTypeId: ID!, $attributeIds: [ID!]!
) {
pageAttributeUnassign(
pageTypeId: $pageTypeId, attributeIds: $attributeIds
) {
... | 131 | 3,958 |
saleor | saleor/graphql/page/tests/mutations/test_page_bulk_publish.py | .py | import graphene
from .....page.models import Page
from ....tests.utils import get_graphql_content
MUTATION_PUBLISH_PAGES = """
mutation publishManyPages($ids: [ID!]!, $is_published: Boolean!) {
pageBulkPublish(ids: $ids, isPublished: $is_published) {
count
}
}
"""
def test_bu... | 47 | 1,681 |
saleor | saleor/graphql/page/tests/mutations/test_page_bulk_delete.py | .py | import graphene
import pytest
from .....attribute.models import AttributeValue
from .....attribute.utils import associate_attribute_values_to_instance
from .....page.models import Page
from .....product.search import update_products_search_vector
from ....tests.utils import get_graphql_content
PAGE_BULK_DELETE_MUTATI... | 277 | 8,283 |
saleor | saleor/graphql/page/tests/mutations/test_page_types_bulk_delete.py | .py | from unittest import mock
import graphene
import pytest
from .....attribute.models import AttributeValue
from .....attribute.utils import associate_attribute_values_to_instance
from .....page.models import Page
from .....product.search import update_products_search_vector
from ....tests.utils import assert_no_permiss... | 314 | 9,131 |
saleor | saleor/graphql/page/tests/mutations/test_page_type_delete.py | .py | import json
from unittest import mock
import graphene
import pytest
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....attribute.models import AttributeValue
from .....attribute.utils import associate_attribute_values_to_instance
from .....core.utils.json_serializer impor... | 287 | 8,646 |
saleor | saleor/graphql/page/tests/mutations/test_page_type_update.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....core.utils.json_serializer import CustomJsonEncoder
from .....page.error_codes import PageErrorCode
from .....page.models import PageType
from .....webhook.event_types... | 559 | 16,470 |
saleor | saleor/graphql/page/tests/mutations/test_page_type_reorder_attributes.py | .py | import graphene
from .....page.error_codes import PageErrorCode
from .....page.models import PageType
from ....tests.utils import assert_no_permission, get_graphql_content
PAGE_TYPE_REORDER_ATTRIBUTES_MUTATION = """
mutation PageTypeReorderAttributes(
$pageTypeId: ID!
$moves: [ReorderInput!]!
... | 311 | 8,857 |
saleor | saleor/graphql/page/tests/mutations/test_page_attribute_assign.py | .py | from unittest.mock import ANY
import graphene
from .....page.error_codes import PageErrorCode
from ....tests.utils import assert_no_permission, get_graphql_content
PAGE_ASSIGN_ATTR_QUERY = """
mutation assign($pageTypeId: ID!, $attributeIds: [ID!]!) {
pageAttributeAssign(pageTypeId: $pageTypeId, attributeI... | 438 | 13,406 |
saleor | saleor/graphql/page/tests/mutations/test_page_delete.py | .py | from functools import partial
from unittest import mock
from unittest.mock import ANY
import graphene
import pytest
from django.utils.functional import SimpleLazyObject
from .....attribute.models import AttributeValue
from .....attribute.utils import associate_attribute_values_to_instance
from .....product.search imp... | 322 | 9,971 |
saleor | saleor/graphql/page/tests/mutations/test_page_reorder_attribute_values.py | .py | import graphene
from .....attribute.models import AttributeValue
from .....attribute.utils import associate_attribute_values_to_instance
from .....page.error_codes import PageErrorCode
from ....tests.utils import get_graphql_content
PAGE_REORDER_ATTRIBUTE_VALUES_MUTATION = """
mutation PageReorderAttributeValues(... | 239 | 7,249 |
saleor | saleor/graphql/page/tests/mutations/test_page_type_create.py | .py | import json
from unittest import mock
import graphene
from django.utils.functional import SimpleLazyObject
from freezegun import freeze_time
from .....core.utils.json_serializer import CustomJsonEncoder
from .....page.error_codes import PageErrorCode
from .....page.models import PageType
from .....webhook.event_types... | 354 | 10,099 |
saleor | saleor/graphql/page/mutations/page_type_delete.py | .py | import graphene
from django.db.models.expressions import Exists, OuterRef
from ....attribute import AttributeInputType
from ....attribute import models as attribute_models
from ....core.tracing import traced_atomic_transaction
from ....page import models
from ....permission.enums import PageTypePermissions
from ....pr... | 80 | 3,154 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.