Skip to content

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

Restore staff_user_added_note_to_a_customer_event

IKarbowiak079fbe9798d6
diff --git a/saleor/account/events.py b/saleor/account/events.py
index 450b1d88a6..43c43373ad 100644
--- a/saleor/account/events.py
+++ b/saleor/account/events.py
@@ -84,6 +84,17 @@ def staff_user_assigned_email_to_a_customer_event(
)
+def staff_user_added_note_to_a_customer_event(
+ *, staff_user: UserType, note: str
+) -> CustomerEvent:
+ return CustomerEvent.objects.create(
+ user=staff_user,
+ order=None,
+ type=CustomerEvents.NOTE_ADDED,
+ parameters={"message": note},
+ )
+
+
def staff_user_assigned_name_to_a_customer_event(
*, staff_user: UserType, new_name: str
) -> CustomerEvent:
diff --git a/tests/api/test_account_events.py b/tests/api/test_account_events.py
index f47f143815..405f47b30b 100644
--- a/tests/api/test_account_events.py
+++ b/tests/api/test_account_events.py
@@ -317,3 +317,26 @@ def test_account_event_staff_user_assigned_email_to_customer_event_resolves_prop
)
assert expected_data == received_data
+
+
+def test_account_event_staff_user_added_note_to_customer_event_resolves_properly(
+ staff_api_client, staff_user, permission_manage_staff
+):
+ event = account_events.staff_user_added_note_to_a_customer_event(
+ staff_user=staff_user, note="New note's content!"
+ )
+ expected_data = {
+ "id": _model_to_node_id(event),
+ "user": {"id": _model_to_node_id(staff_user)},
+ "count": None,
+ "message": "New note's content!",
+ "order": None,
+ "orderLine": None,
+ "type": account_events.CustomerEvents.NOTE_ADDED.upper(),
+ }
+
+ received_data = _get_event_from_graphql(
+ staff_api_client, staff_user, permission_manage_staff
+ )
+
+ assert expected_data == received_data