Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Mock missing test and fix wrong mock imports

NyanKiyoshia201b61e0da9
diff --git a/tests/api/test_account.py b/tests/api/test_account.py
index 59185d9c1e..01399a4ec5 100644
--- a/tests/api/test_account.py
+++ b/tests/api/test_account.py
@@ -27,7 +27,6 @@ from saleor.order.models import FulfillmentStatus, Order
from tests.api.utils import get_graphql_content
from tests.utils import create_image
-from ..checks import customers as customer_checks
from .utils import (
assert_no_permission,
convert_dict_keys_to_camel_case,
@@ -782,8 +781,15 @@ def test_logged_customer_update_anonymus_user(api_client):
assert_no_permission(response)
+@patch(
+ "saleor.graphql.account.utils.customer_events.staff_user_deleted_a_customer_event"
+)
def test_customer_delete(
- staff_api_client, staff_user, customer_user, permission_manage_users
+ mocked_deletion_event,
+ staff_api_client,
+ staff_user,
+ customer_user,
+ permission_manage_users,
):
"""Ensure deleting a customer actually deletes the customer and creates proper
related events"""
@@ -813,7 +819,9 @@ def test_customer_delete(
# Ensure the customer was properly deleted
# and any related event was properly triggered
- customer_checks.was_customer_properly_deleted(staff_user, customer_user)
+ mocked_deletion_event.assert_called_once_with(
+ staff_user=staff_user, deleted_count=1
+ )
def test_customer_delete_errors(customer_user, admin_user, staff_user):
diff --git a/tests/api/test_bulk_delete.py b/tests/api/test_bulk_delete.py
index 67664a91af..766c617360 100644
--- a/tests/api/test_bulk_delete.py
+++ b/tests/api/test_bulk_delete.py
@@ -1,6 +1,7 @@
+from unittest.mock import patch
+
import graphene
import pytest
-from mock import patch
from saleor.account.models import User
from saleor.discount.models import Sale, Voucher
diff --git a/tests/dashboard/test_customer.py b/tests/dashboard/test_customer.py
index f1c6b1983d..b37883bbcb 100644
--- a/tests/dashboard/test_customer.py
+++ b/tests/dashboard/test_customer.py
@@ -1,4 +1,5 @@
import json
+from unittest.mock import patch
from django.contrib.auth.tokens import default_token_generator
from django.core import mail
@@ -6,7 +7,6 @@ from django.templatetags.static import static
from django.urls import reverse
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
-from mock import patch
from templated_email import send_templated_mail
from saleor.account.models import CustomerNote, User