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/core/tests/utils.py
.py
from django.conf import settings from ..notification.utils import LOGO_URL def get_site_context_payload(site): return { "site_name": site.name, "domain": "example.com", "logo_url": f"https://example.com{settings.STATIC_URL}{LOGO_URL}", }
12
273
saleor
saleor/core/tests/test_schedules.py
.py
import datetime import pytest from celery.schedules import BaseSchedule from django.utils import timezone from django.utils.module_loading import import_string from freezegun import freeze_time from ...checkout import CheckoutAuthorizeStatus from ...checkout.models import Checkout from ...discount.models import Promo...
586
17,989
saleor
saleor/core/tests/test_search_tasks.py
.py
from ...account.search import update_user_search_vector from ...core.postgres import FlatConcatSearchVector from ...core.search_tasks import ( set_order_search_document_values, set_user_search_document_values, ) def test_set_user_search_document_values(customer_user, customer_user2): # given assert no...
56
1,483
saleor
saleor/core/tests/test_middleware.py
.py
from django.core.handlers.base import BaseHandler from freezegun import freeze_time from ..jwt import ( JWT_REFRESH_TOKEN_COOKIE_NAME, JWT_REFRESH_TYPE, create_refresh_token, jwt_encode, jwt_user_payload, ) @freeze_time("2020-03-18 12:00:00") def test_jwt_refresh_token_middleware(rf, customer_use...
80
2,610
saleor
saleor/core/tests/test_jwt_manager.py
.py
import json import jwt import pytest from cryptography.hazmat.primitives import serialization from django.core.exceptions import ImproperlyConfigured from django.test import override_settings from ..jwt_manager import JWTManager, get_jwt_manager def test_get_jwt_manager(settings): # given assert settings.JW...
123
3,253
saleor
saleor/core/tests/test_search.py
.py
import pytest from django.db.models import Value from ...account.models import User from ...account.search import update_user_search_vector from ...checkout.models import Checkout from ...checkout.search.indexing import update_checkouts_search_vector from ...product.models import Product, ProductChannelListing from .....
513
14,780
saleor
saleor/core/tests/test_jwt.py
.py
import graphene import jwt from cryptography.hazmat.primitives import serialization from django.urls import reverse from ..jwt import ( JWT_ACCESS_TYPE, create_access_token_for_app, create_access_token_for_app_extension, get_user_from_access_payload, jwt_decode, jwt_encode, jwt_user_payload...
225
6,550
saleor
saleor/core/tests/test_postgresql_search.py
.py
import pytest from django.contrib.postgres.search import SearchVector from django.db.models import Value from django.utils.text import slugify from ...account.models import Address from ...product.models import Product, ProductChannelListing from ...tests.utils import dummy_editorjs from ..postgres import FlatConcat f...
129
4,178
saleor
saleor/core/tests/test_auth_backend_default_header.py
.py
import jwt import pytest from freezegun import freeze_time from jwt import ExpiredSignatureError, InvalidSignatureError, InvalidTokenError from ...permission.enums import get_permissions_from_names from ...permission.models import Permission from ...site import PasswordLoginMode from ..auth_backend import JSONWebToken...
325
11,568
saleor
saleor/core/tests/test_anonymize.py
.py
from ..anonymize import obfuscate_address, obfuscate_email, obfuscate_string def test_obfuscate_email(): # given email = "abc@gmail.com" # when result = obfuscate_email(email) # then assert result == "a...@gmail.com" def test_obfuscate_email_example_email(): # given email = "abc@ex...
98
1,999
saleor
saleor/core/tests/test_sqs.py
.py
from datetime import timedelta from unittest.mock import MagicMock, Mock, patch import pytest from django.utils import timezone from freezegun import freeze_time from ..sqs import Channel @pytest.mark.parametrize( ("eta_offset", "expected_delay"), [ (timedelta(seconds=359, microseconds=84649), 359),...
86
2,657
saleor
saleor/core/tests/test_weight.py
.py
import pytest from measurement.measures import Weight from ..units import WeightUnits from ..weight import ( convert_weight, convert_weight_to_default_weight_unit, get_default_weight_unit, ) def test_convert_weight(): # given weight = Weight(kg=1) expected_result = Weight(g=1000) # when ...
53
1,213
saleor
saleor/core/tests/test_rlimit.py
.py
import resource from unittest.mock import patch import pytest from django.core.exceptions import ImproperlyConfigured from ..rlimit import RLIMIT_TYPE, validate_and_set_rlimit @patch("saleor.core.rlimit.resource.setrlimit") def test_limit_passed_as_string(mock_setrlimit): # given soft_limit = "1000" har...
160
3,790
saleor
saleor/core/tests/test_notification.py
.py
import pytest from django.core.exceptions import ValidationError from ...core.notification.validation import validate_and_get_channel from ...graphql.notifications.error_codes import ExternalNotificationErrorCodes def test_validate_and_get_channel_for_non_existing_slug(): with pytest.raises(ValidationError): ...
35
1,124
saleor
saleor/core/tests/test_view.py
.py
import functools from pathlib import Path import jwt import pytest from django.http import FileResponse, Http404 from django.test import RequestFactory from jwt import PyJWK from ..jwt_manager import get_jwt_manager from ..views import serve_media_view @pytest.fixture def dummy_media_file_request(media_root: str): ...
85
2,393
saleor
saleor/core/tests/test_taxes.py
.py
import graphene import pytest from ...app.models import App from ...permission.enums import ( CheckoutPermissions, get_permissions_from_codenames, ) from ...webhook.event_types import WebhookEventSyncType from ...webhook.models import Webhook, WebhookEvent @pytest.fixture def app_factory(): def factory(n...
63
1,788
saleor
saleor/core/tests/test_text.py
.py
from ..utils.text import strip_accents def test_strip_accents_removes_diacritics(): assert strip_accents("Magnésium") == "Magnesium" def test_strip_accents_removes_multiple_diacritics(): assert strip_accents("café") == "cafe" def test_strip_accents_removes_diaeresis(): assert strip_accents("naïve") ==...
22
509
saleor
saleor/core/tests/commands/test_clearorders.py
.py
import pytest from django.core.management import call_command from ....checkout.models import Checkout, CheckoutDelivery @pytest.mark.django_db @pytest.mark.parametrize( ("_case", "assign_delivery"), [ # These two cases cause two different types of FK-checks # which can cause PostgreSQL to re...
37
1,162
saleor
saleor/core/tests/commands/test_clean_editorjs_fields.py
.py
# ruff: noqa: UP031 # printf-style string formatting are more readable for JSON import random import re from copy import deepcopy from io import StringIO from unittest import mock import pytest from django.core.management import call_command from django.core.management.base import CommandError from ....attribute.mode...
251
7,758
saleor
saleor/core/utils/metadata_manager.py
.py
from dataclasses import dataclass from enum import Enum from typing import Any from ...graphql.meta.inputs import MetadataInput from ..models import ModelWithMetadata class MetadataType(Enum): PUBLIC = "PUBLIC" PRIVATE = "PRIVATE" class MetadataEmptyKeyError(Exception): pass @dataclass class Metadata...
86
2,146
saleor
saleor/core/utils/batches.py
.py
from django.db.models import QuerySet def queryset_in_batches(queryset: QuerySet, batch_size: int): """Slice a queryset into batches.""" start_pk = 0 while True: qs = queryset.filter(pk__gt=start_pk).order_by("pk")[:batch_size] pks = list(qs.values_list("pk", flat=True)) if not p...
18
389
saleor
saleor/core/utils/random_data.py
.py
import datetime import itertools import json import os import random import unicodedata import uuid from collections import defaultdict from decimal import Decimal from functools import lru_cache from typing import Any, cast from unittest.mock import patch import graphene from django.conf import settings from django.c...
1,915
62,627
saleor
saleor/core/utils/lazyobjects.py
.py
import functools from collections.abc import Callable from typing import Any from django.utils.functional import LazyObject, SimpleLazyObject, empty def lazy_no_retry(func: Callable) -> SimpleLazyObject: """Wrap SimpleLazyObject while ensuring it is never re-evaluated on failure. Wraps a given function into...
41
1,275
saleor
saleor/core/utils/translations.py
.py
from typing import Any from django.conf import settings from django.db import models class TranslationWrapper: def __init__(self, instance, locale): self.instance = instance self.translation = next( (t for t in instance.translations.all() if t.language_code == locale), None ) ...
54
1,529
saleor
saleor/core/utils/__init__.py
.py
import socket from collections.abc import Iterable from io import BytesIO from typing import TYPE_CHECKING from urllib.parse import urljoin, urlparse from django.conf import settings from django.contrib.sites.models import Site from django.core.files import File from django.db.models import Model from django.utils.enc...
172
5,373
saleor
saleor/core/utils/date_time.py
.py
import datetime def convert_to_utc_date_time(date) -> None | datetime.datetime: """Convert date into utc date time.""" if date is None: return None return datetime.datetime.combine( date, datetime.datetime.min.time(), tzinfo=datetime.UTC )
11
274
saleor
saleor/core/utils/promo_code.py
.py
import secrets from django.core.exceptions import ValidationError from ...discount.models import VoucherCode from ...giftcard.error_codes import GiftCardErrorCode from ...giftcard.models import GiftCard class InvalidPromoCode(ValidationError): def __init__(self, message=None, **kwargs): if message is No...
45
1,310
saleor
saleor/core/utils/update_mutation_manager.py
.py
from copy import deepcopy from typing import Any, TypeVar from django.db.models import Model T = TypeVar("T", bound=Model) class InstanceTracker: """Instance with modifications tracker. It is used to determine modified fields of the instance. """ def __init__( self, instance: T | N...
71
2,397
saleor
saleor/core/utils/text.py
.py
import unicodedata def strip_accents(text: str) -> str: """Remove diacritical marks from text, e.g. 'Magnésium' → 'Magnesium'.""" nfkd = unicodedata.normalize("NFKD", text) return "".join(c for c in nfkd if not unicodedata.combining(c)) def safe_truncate(text: str, max_length: int) -> str: """Trunca...
26
994
saleor
saleor/core/utils/url.py
.py
from urllib.parse import urlparse, urlsplit from django.conf import settings from django.core.exceptions import ValidationError from django.core.files.storage import default_storage from django.http.request import split_domain_port, validate_host from . import build_absolute_uri def validate_storefront_url(url): ...
64
2,304
saleor
saleor/core/utils/json_serializer.py
.py
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import Serializer as JsonSerializer from measurement.measures import Weight from prices import Money MONEY_TYPE = "Money" class Serializer(JsonSerializer): def _init_options(self): super()._init_options() # type...
23
806
saleor
saleor/core/utils/cache.py
.py
import collections class CacheDict(collections.OrderedDict): def __init__(self, capacity: int): self.capacity = capacity super().__init__() def __getitem__(self, key): value = super().__getitem__(key) super().move_to_end(key) return value def __setitem__(self, key...
21
525
saleor
saleor/core/utils/country.py
.py
from typing import TYPE_CHECKING, Optional from ...account.models import Address from ...channel.models import Channel if TYPE_CHECKING: from ...graphql.account.types import AddressInput def get_active_country( channel: "Channel", shipping_address: Optional["Address"] = None, billing_address: Option...
37
1,237
saleor
saleor/core/utils/anonymization.py
.py
import copy import logging from typing import TYPE_CHECKING from faker import Faker from ...account.models import Address, User from ...checkout.utils import get_or_create_checkout_metadata from .random_data import create_address, create_fake_user if TYPE_CHECKING: from ...checkout.models import Checkout fro...
88
2,939
saleor
saleor/core/utils/validators.py
.py
import datetime from typing import Any import micawber from ...product import ProductMediaTypes from ..exceptions import UnsupportedMediaProviderException SUPPORTED_MEDIA_TYPES = { "photo": ProductMediaTypes.IMAGE, "video": ProductMediaTypes.VIDEO, } MEDIA_MAX_WIDTH = 1920 MEDIA_MAX_HEIGHT = 1080 def get_o...
53
1,621
saleor
saleor/core/utils/events.py
.py
from django.db import transaction from ...webhook.event_types import WebhookEventAsyncType def get_is_deferred_payload(event_name: str) -> bool: """Return True if the event has deferred payload. When the event has deferred payload, the payload will be generated in the Celery task during webhook delivery...
29
979
saleor
saleor/core/utils/tests/test_metadata_manager.py
.py
import pytest from ..metadata_manager import metadata_is_valid @pytest.mark.parametrize( "metadata", [ {"key1": "value1", "key2": "value2"}, {}, {"key1": ""}, ], ) def test_metadata_is_valid_true(metadata): # when is_metadata_valid = metadata_is_valid(metadata) # then...
39
709
saleor
saleor/core/utils/tests/test_url.py
.py
from collections import OrderedDict from urllib.parse import urlencode import pytest from django.conf import settings from ..url import get_default_storage_root_url, prepare_url, sanitize_url_for_logging def test_prepare_url(): redirect_url = "https://www.example.com" params = urlencode({"param1": "abc", "p...
54
1,764
saleor
saleor/core/utils/tests/test_serializer.py
.py
import json from measurement.measures import Weight from ...taxes import zero_money from ..json_serializer import CustomJsonEncoder def test_custom_json_encoder_dumps_money_objects(): # given currency = "usd" input = {"money": zero_money(currency)} # when serialized_data = json.dumps(input, cls...
34
795
saleor
saleor/core/utils/tests/test_validators.py
.py
import pytest from ..validators import get_mime_type, is_image_mimetype, is_valid_image_content_type def test_is_image_mimetype_valid_mimetype(): # given valid_mimetype = "image/jpeg" # when result = is_image_mimetype(valid_mimetype) # then assert result def test_is_image_mimetype_invalid...
69
1,709
saleor
saleor/core/utils/tests/test_events.py
.py
from unittest import mock from django.db import transaction from ..events import call_event @mock.patch.object(transaction, "get_connection", wraps=transaction.get_connection) def test_call_event_triggers_provided_method( mocked_transaction, checkout_info, plugins_manager, django_capture_on_commit_c...
27
706
saleor
saleor/core/utils/tests/test_update_mutation_manager.py
.py
from ....order import OrderStatus from ..update_mutation_manager import InstanceTracker def test_instance_tracker(product): # given fields_to_track = ["name", "slug"] tracker = InstanceTracker(product, fields_to_track) # when product.name = product.name + "_updated" modified_field = tracker.g...
103
2,932
saleor
saleor/core/utils/tests/test_cache.py
.py
from ..cache import CacheDict def test_capacity(): # given cache = CacheDict(2) cache[1] = "a" cache[2] = "b" # when cache[3] = "c" # then assert 1 not in cache assert 2 in cache assert 3 in cache def test_persistence(): # given cache = CacheDict(2) watchdog = o...
45
638
saleor
saleor/core/utils/tests/test_text.py
.py
from ..text import safe_truncate def test_safe_truncate(): assert safe_truncate("Hello, world!", 5) == "Hell…" assert safe_truncate("Hello, world!", 20) == "Hello, world!" assert safe_truncate("Hello, 世界!", 9) == "Hello, 世…" assert safe_truncate("Hello, 世界!", 15) == "Hello, 世界!" assert safe_trunca...
17
694
saleor
saleor/core/db/fields.py
.py
from collections.abc import Callable from decimal import Decimal from functools import total_ordering import orjson from django.core import validators from django.db.models import Field, JSONField from django.db.models.expressions import Expression from prices import Money, TaxedMoney class SanitizedJSONField(JSONFi...
183
5,978
saleor
saleor/core/db/filters.py
.py
from django.db.models.lookups import IContains class PostgresILike(IContains): lookup_name = "ilike" def as_postgresql(self, compiler, connection): lhs, lhs_params = self.process_lhs(compiler, connection) rhs, rhs_params = self.process_rhs(compiler, connection) params = lhs_params + r...
12
400
saleor
saleor/core/db/patch.py
.py
from django.db.backends.base.validation import BaseDatabaseValidation from django.db.backends.postgresql.client import DatabaseClient from django.db.backends.postgresql.creation import DatabaseCreation from django.db.backends.postgresql.features import DatabaseFeatures from django.db.backends.postgresql.introspection i...
33
1,471
saleor
saleor/core/db/connection.py
.py
import logging import traceback from contextlib import contextmanager from django.conf import settings from django.core.management.color import color_style from django.db import connections from django.db.backends.base.base import BaseDatabaseWrapper from ...graphql.core.context import SaleorContext, get_database_con...
135
4,994
saleor
saleor/core/db/expressions.py
.py
from django.db.models import Case, F, JSONField, Value, When from django.db.models.expressions import Expression class PostgresJsonConcatenate(Expression): """Implementation of PostgreSQL concatenation for JSON fields. Inserts or updates specific keys provided in the database for `jsonb` field type. If a...
86
3,085
saleor
saleor/core/db/tests/test_connection.py
.py
from unittest.mock import patch import pytest from django.db import connections from ....graphql.context import SaleorContext from ....tests.models import Book from ..connection import ( UnsafeWriterAccessError, allow_writer, allow_writer_in_context, log_writer_usage, restrict_writer, ) def test...
89
2,651
saleor
saleor/core/db/tests/test_postgres_json_concatenate.py
.py
import pytest from django.db.models import CharField, F, JSONField, Value from ....checkout.models import CheckoutMetadata from ..expressions import PostgresJsonConcatenate TEST_KEY = "test-key" TEST_VALUE = "test_value" TEST_DICT = {TEST_KEY: TEST_VALUE} @pytest.fixture def checkout_metadata_qs(checkout): retu...
223
6,507
saleor
saleor/core/templatetags/taxed_prices.py
.py
from django import template from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange register = template.Library() def _get_display_price( base: TaxedMoney | TaxedMoneyRange, display_gross: bool ) -> Money: """Return the price amount that should be displayed based on settings.""" if isinstance(b...
29
943
saleor
saleor/core/pricing/interface.py
.py
from collections.abc import Iterable from dataclasses import dataclass, field from typing import TYPE_CHECKING, Optional, Union from ...discount import DiscountType if TYPE_CHECKING: from ...channel.models import Channel from ...checkout.models import CheckoutLine from ...discount.models import CheckoutLi...
62
1,671
saleor
saleor/tests/utils.py
.py
import json import math from decimal import Decimal from typing import Any, Literal, overload import pytest from django.conf import settings from django.db import connections from opentelemetry.sdk.metrics.export import DataPointT, Metric, MetricsData from opentelemetry.sdk.trace import ReadableSpan from ..core.db.co...
143
5,254
saleor
saleor/tests/models.py
.py
from django.db import models class Book(models.Model): name = models.CharField(max_length=30)
6
100
saleor
saleor/tests/runner.py
.py
class PytestTestRunner: """Runs pytest to discover and run tests.""" def __init__(self, verbosity=1, failfast=False, keepdb=True, **kwargs): self.verbosity = verbosity self.failfast = failfast self.keepdb = keepdb def run_tests(self, test_labels): """Run pytest and return t...
31
853
saleor
saleor/tests/storages.py
.py
from django.conf import settings from django.core.files.storage import FileSystemStorage class PrivateFileSystemStorage(FileSystemStorage): @property def base_location(self): return settings.PRIVATE_MEDIA_ROOT
9
228
saleor
saleor/tests/__init__.py
.py
import pytest # We want to have PyTest assert introspection in the API tests pytest.register_assert_rewrite("saleor.tests.e2e")
5
129
saleor
saleor/tests/fixtures.py
.py
import datetime from contextlib import contextmanager from functools import partial from io import BytesIO from unittest.mock import MagicMock import graphene import pytest from django.conf import settings from django.core.cache import cache from django.core.files.uploadedfile import SimpleUploadedFile from django.db ...
1,758
58,348
saleor
saleor/tests/dummy_password_hasher.py
.py
from collections import OrderedDict from django.contrib.auth.hashers import BasePasswordHasher class DummyHasher(BasePasswordHasher): """Dummy password hasher used only for unit tests purpose. Overwriting default Django password hasher significantly reduces the time of test execution. """ algor...
30
851
saleor
saleor/tests/settings.py
.py
import re from re import Pattern from django.utils.functional import SimpleLazyObject from ..settings import * # noqa: F403 def lazy_re_compile(regex, flags=0): """Lazily compile a regex with flags.""" def _compile(): # Compile the regex if it was not passed pre-compiled. if isinstance(reg...
110
4,176
saleor
saleor/tests/test_cache_key_warning.py
.py
import warnings from django.core.cache import CacheKeyWarning, cache def test_ignore_cache_key_warning(): key_over_250_characters = 300 * "x" # Ensure all warnings are errors warnings.simplefilter("error") # Ignore CacheKeyWarning warnings.filterwarnings("ignore", category=CacheKeyWarning) ...
17
405
saleor
saleor/tests/race_condition.py
.py
from functools import wraps from unittest.mock import patch class RaceConditionTrigger: def __init__(self, target, callback): self.target = target self.callback = callback self.has_been_called = False def __enter__(self): self.patched_function = patch(self.target) orig...
53
1,892
saleor
saleor/tests/test_db_connections.py
.py
import pytest from django.conf import settings from ..app.models import App, AppExtension def test_subqueries_no_allowed_across_different_databases(app_with_extensions): replica = settings.DATABASE_CONNECTION_REPLICA_NAME writer = settings.DATABASE_CONNECTION_DEFAULT_NAME subquery = App.objects.using(rep...
17
541
saleor
saleor/tests/e2e/utils.py
.py
import json from ...account.models import Group from ...graphql.tests.utils import ( get_graphql_content, # noqa: F401 get_multipart_request_body, # noqa: F401 ) def assign_permissions(api_client, permissions): user = api_client.user if user: group = Group.objects.create( name="...
55
1,705
saleor
saleor/tests/e2e/__init__.py
.py
DEFAULT_ADDRESS = { "firstName": "John Saleor", "lastName": "Doe Mirumee", "companyName": "Saleor Commerce", "streetAddress1": "14208 Hawthorne Blvd", "streetAddress2": "", "postalCode": "90250", "country": "US", "city": "Hawthorne", "countryArea": "CA", "phone": "+12025550163", ...
39
953
saleor
saleor/tests/e2e/test_utils.py
.py
import json from unittest.mock import Mock from .utils import request_matcher def test_equal_dicts(): r1 = Mock( body=Mock( decode=Mock(return_value=json.dumps({"key1": "value1", "key2": "value2"})) ) ) r2 = Mock( body=Mock( decode=Mock(return_value=json.du...
125
2,974
saleor
saleor/tests/e2e/conftest.py
.py
import json import pytest from django.core.serializers.json import DjangoJSONEncoder from django.test import TestCase from django.test.client import MULTIPART_CONTENT, Client from ...account.tests.fixtures.user import dangerously_create_test_user from ...app.models import App from ...graphql.tests.fixtures import Bas...
98
2,627
saleor
saleor/tests/e2e/webhooks/utils.py
.py
from ..utils import get_graphql_content WEBHOOK_CREATE_MUTATION = """ mutation WebhookCreate($input: WebhookCreateInput!) { webhookCreate(input: $input) { errors { field code message } webhook { id name isActive targetUrl syncEvents{ eventType ...
51
866
saleor
saleor/tests/e2e/orders/test_draft_order_complete_with_transaction.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..transactions.utils import create_transaction from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_ord...
117
3,435
saleor
saleor/tests/e2e/orders/test_changing_order_address_not_update_the_customer_one.py
.py
import pytest from .. import ADDRESS_DE, DEFAULT_ADDRESS from ..account.utils import get_own_data, get_user from ..checkout.utils import ( checkout_create, checkout_delivery_method_update, raw_checkout_complete, ) from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_sho...
162
5,319
saleor
saleor/tests/e2e/orders/test_order_cancel_fulfillment.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_fulfill, ...
166
4,491
saleor
saleor/tests/e2e/orders/test_order_keep_address_information.py
.py
import pytest from .. import ADDRESS_DE, DEFAULT_ADDRESS from ..account.utils import account_address_delete, create_customer, get_user from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assert_address_data, assign_permissions f...
132
4,148
saleor
saleor/tests/e2e/orders/test_order_staff_can_create_order_with_the_same_variant_in_multiple_lines_and_overwrite_prices.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, order_lines_c...
118
3,745
saleor
saleor/tests/e2e/orders/test_order_create_invoice_with_metadata.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_fulfill, ...
145
3,881
saleor
saleor/tests/e2e/orders/test_order_void_payment.py
.py
import pytest from ..checkout.utils import ( checkout_complete, checkout_create, checkout_delivery_method_update, raw_checkout_dummy_payment_create, ) from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_pe...
119
3,398
saleor
saleor/tests/e2e/orders/test_unable_to_update_save_settings_after_order_completion.py
.py
import pytest from .. import ADDRESS_DE, DEFAULT_ADDRESS from ..account.utils import create_customer from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assert_address_data, assign_permissions from .utils import ( draft_orde...
129
3,959
saleor
saleor/tests/e2e/orders/test_complete_draft_order_for_existing_customer.py
.py
import pytest from ..account.utils import create_customer from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, ...
134
3,843
saleor
saleor/tests/e2e/orders/test_order_in_channel_with_transaction_flow_as_mark_as_paid_strategy.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_lines_cre...
133
4,120
saleor
saleor/tests/e2e/orders/test_able_to_update_draft_order_after_bulk_order_creation_with_line_discount.py
.py
import graphene from django.utils import timezone from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_shop from ..taxes.utils import update_country_tax_rates from ..utils import assert_address_data, assign_permissions from .utils ...
232
7,566
saleor
saleor/tests/e2e/orders/test_unable_to_void_order_without_payment.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, order_lines_c...
105
2,964
saleor
saleor/tests/e2e/orders/test_order_created_by_staff_member.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..orders.utils.draft_order_complete import draft_order_complete from ..orders.utils.draft_order_create import draft_order_create from ..orders.utils.draft_order_update import draft_order_update from ..orders.utils.order_lines_create import order_lines_create from ..pro...
107
3,189
saleor
saleor/tests/e2e/orders/test_order_void_once_voided_payment.py
.py
import pytest from ..checkout.utils import ( checkout_complete, checkout_create, checkout_delivery_method_update, raw_checkout_dummy_payment_create, ) from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_pe...
126
3,310
saleor
saleor/tests/e2e/orders/test_cancel_partially_paid_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..transactions.utils import create_transaction from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_ord...
125
3,995
saleor
saleor/tests/e2e/orders/test_order_is_expired_after_specific_time.py
.py
import datetime import pytest from django.utils import timezone from freezegun import freeze_time from ....order.tasks import expire_orders_task from ..checkout.utils import checkout_create, checkout_delivery_method_update from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop ...
123
3,813
saleor
saleor/tests/e2e/orders/test_expired_order_is_deleted_after_specified_time.py
.py
import datetime import pytest from django.utils import timezone from freezegun import freeze_time from ....order.tasks import delete_expired_orders_task, expire_orders_task from ..checkout.utils import checkout_create, checkout_delivery_method_update from ..product.utils.preparing_product import prepare_product from ...
137
4,474
saleor
saleor/tests/e2e/orders/test_order_staff_can_overwrite_prices.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils.draft_order_complete import draft_order_complete from .utils.draft_order_create import draft_order_c...
100
3,104
saleor
saleor/tests/e2e/orders/test_cannot_fullfill_order_with_invalid_shipping_method.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils.draft_order_complete import raw_draft_order_complete from .utils.draft_order_create import draft_order_create from .utils.d...
151
4,433
saleor
saleor/tests/e2e/orders/test_order_mark_as_paid.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_pa...
103
2,968
saleor
saleor/tests/e2e/orders/test_app_can_create_order_from_checkout.py
.py
import pytest from ..checkout.utils import checkout_create, checkout_delivery_method_update from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import order_create_from_checkout @pytest.mark.e2e ...
86
2,551
saleor
saleor/tests/e2e/orders/test_manage_products_on_draft_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, order_line_delete, order_line_upd...
122
4,427
saleor
saleor/tests/e2e/orders/test_cancel_unpaid_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, order_cancel,...
96
2,872
saleor
saleor/tests/e2e/orders/test_cancel_fully_paid_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..transactions.utils import create_transaction from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_ord...
116
3,931
saleor
saleor/tests/e2e/orders/test_draft_order_update_uses_denormalized_prices.py
.py
from decimal import Decimal import pytest from ....core.prices import quantize_price from ....discount.models import PromotionRule from ....product.models import Product from ....product.utils.variant_prices import update_discounted_prices_for_promotion from ....product.utils.variants import fetch_variants_for_promot...
354
13,693
saleor
saleor/tests/e2e/orders/test_bulk_delete_draft_orders.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_bulk_delete, draft_order_create, order_lines_create, order_quer...
83
2,214
saleor
saleor/tests/e2e/orders/test_update_draft_order_metadata.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..metadata.utils import ( delete_metadata, delete_private_metadata, update_metadata, update_private_metadata, ) from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils impor...
137
4,782
saleor
saleor/tests/e2e/orders/test_delete_draft_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_create, draft_order_delete, draft_order_update, order_lines_cre...
96
2,554
saleor
saleor/tests/e2e/orders/test_able_to_decide_if_address_is_saved_in_user_address_book.py
.py
import pytest from .. import ADDRESS_DE, DEFAULT_ADDRESS from ..account.utils import create_customer, get_user from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assert_address_data, assign_permissions from .utils import ( ...
236
7,444
saleor
saleor/tests/e2e/orders/test_order_fulfill_and_add_tracking.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils import prepare_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_paid, order_add_track...
164
4,394
saleor
saleor/tests/e2e/orders/test_unable_to_void_order_marked_as_paid.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_order_create, draft_order_update, mark_order_pa...
115
2,972