Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/sentry/testutils/helpers/data_blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,60 +756,60 @@
]

EMAIL_ACTION_DATA_BLOBS: list[dict[str, Any]] = [
# IssueOwners (targetIdentifier is "None")
# IssueOwners (target_identifier is "None")
{
"targetType": "IssueOwners",
"target_type": "IssueOwners",
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": "None",
"target_identifier": "None",
"fallthrough_type": "ActiveMembers",
"uuid": "2e8847d7-8fe4-44d2-8a16-e25040329790",
},
# NoOne Fallthrough (targetIdentifier is "")
# NoOne fallthrough (target_identifier is "")
{
"targetType": "IssueOwners",
"targetIdentifier": "",
"target_type": "IssueOwners",
"target_identifier": "",
"id": "sentry.mail.actions.NotifyEmailAction",
"fallthrough_type": "NoOne",
"uuid": "fb039430-0848-4fc4-89b4-bc7689a9f851",
},
# AllMembers Fallthrough (targetIdentifier is None)
# AllMembers fallthrough (target_identifier is None)
{
"targetType": "IssueOwners",
"target_type": "IssueOwners",
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": None,
"target_identifier": None,
"fallthrough_type": "AllMembers",
"uuid": "41f13756-8f90-4afe-b162-55268c6e3cdb",
},
# NoOne Fallthrough (targetIdentifier is "None")
# NoOne fallthrough (target_identifier is "None")
{
"targetType": "IssueOwners",
"target_type": "IssueOwners",
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": "None",
"target_identifier": "None",
"fallthrough_type": "NoOne",
"uuid": "99c9b517-0a0f-47f0-b3ff-2a9cd2fd9c49",
},
# ActiveMembers Fallthrough
# ActiveMembers fallthrough
{
"targetType": "Member",
"target_type": "Member",
"fallthrough_type": "ActiveMembers",
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": 3234013,
"target_identifier": 3234013,
"uuid": "6e83337b-9561-4167-a208-27d6bdf5e613",
},
# Member Email
{
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": 2160509,
"targetType": "Member",
"target_identifier": 2160509,
"target_type": "Member",
"uuid": "42c3e1d6-4004-4a51-a90b-13d3404f1e55",
},
# Team Email
{
"targetType": "Team",
"target_type": "Team",
"id": "sentry.mail.actions.NotifyEmailAction",
"fallthrough_type": "AllMembers",
"uuid": "71b445cf-573b-4e0c-86bc-8dfbad93c480",
"targetIdentifier": 188022,
"target_identifier": 188022,
},
]

Expand Down
4 changes: 2 additions & 2 deletions src/sentry/workflow_engine/typings/notification_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class EmailFieldMappingKeys(StrEnum):
"""

FALLTHROUGH_TYPE_KEY = "fallthrough_type"
TARGET_TYPE_KEY = "targetType"
TARGET_TYPE_KEY = "target_type"


class ActionFieldMapping(TypedDict):
Expand Down Expand Up @@ -161,7 +161,7 @@ class ActionFieldMapping(TypedDict):
),
ActionType.EMAIL: ActionFieldMapping(
id="sentry.mail.actions.NotifyEmailAction",
target_identifier_key="targetIdentifier",
target_identifier_key="target_identifier",
),
ActionType.PLUGIN: ActionFieldMapping(
id="sentry.rules.actions.notify_event.NotifyEventAction",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,55 +543,55 @@ def setUp(self) -> None:
self.HEALED_EMAIL_ACTION_DATA_BLOBS = [
# IssueOwners (targetIdentifier is "None")
{
"targetType": ActionTargetType.ISSUE_OWNERS.value,
"target_type": ActionTargetType.ISSUE_OWNERS.value,
"id": "sentry.mail.actions.NotifyEmailAction",
"fallthrough_type": FallthroughChoiceType.ACTIVE_MEMBERS,
},
# NoOne Fallthrough (targetIdentifier is "")
{
"targetType": ActionTargetType.ISSUE_OWNERS.value,
"target_type": ActionTargetType.ISSUE_OWNERS.value,
"id": "sentry.mail.actions.NotifyEmailAction",
"fallthrough_type": FallthroughChoiceType.NO_ONE,
},
# AllMembers Fallthrough (targetIdentifier is None)
{
"targetType": ActionTargetType.ISSUE_OWNERS.value,
"target_type": ActionTargetType.ISSUE_OWNERS.value,
"id": "sentry.mail.actions.NotifyEmailAction",
"fallthrough_type": "AllMembers",
},
# NoOne Fallthrough (targetIdentifier is "None")
{
"targetType": ActionTargetType.ISSUE_OWNERS.value,
"target_type": ActionTargetType.ISSUE_OWNERS.value,
"id": "sentry.mail.actions.NotifyEmailAction",
"fallthrough_type": FallthroughChoiceType.NO_ONE,
},
# ActiveMembers Fallthrough
{
"targetType": ActionTargetType.MEMBER.value,
"target_type": ActionTargetType.MEMBER.value,
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": "3234013",
"target_identifier": "3234013",
},
# Member Email
{
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": "2160509",
"targetType": ActionTargetType.MEMBER.value,
"target_identifier": "2160509",
"target_type": ActionTargetType.MEMBER.value,
},
# Team Email
{
"targetType": ActionTargetType.TEAM.value,
"target_type": ActionTargetType.TEAM.value,
"id": "sentry.mail.actions.NotifyEmailAction",
"targetIdentifier": "188022",
"target_identifier": "188022",
},
]

def test_build_rule_action_blob(self) -> None:
for expected, healed in zip(EMAIL_ACTION_DATA_BLOBS, self.HEALED_EMAIL_ACTION_DATA_BLOBS):
action_data = pop_keys_from_data_blob(expected, Action.Type.EMAIL)
# pop the targetType from the action_data
target_type = EmailActionHelper.get_target_type_object(action_data.pop("targetType"))
# pop the target_type from the action_data
target_type = EmailActionHelper.get_target_type_object(action_data.pop("target_type"))
# Handle all possible targetIdentifier formats
target_identifier: str | None = str(expected["targetIdentifier"])
target_identifier: str | None = str(expected["target_identifier"])
if target_identifier in ("None", "", None):
target_identifier = None

Expand Down Expand Up @@ -623,7 +623,7 @@ def test_build_rule_action_blob_fallthrough_type_camel_case(self) -> None:
assert blob == {
"fallthrough_type": FallthroughChoiceType.ACTIVE_MEMBERS,
"id": "sentry.mail.actions.NotifyEmailAction",
"targetType": "IssueOwners",
"target_type": "IssueOwners",
}


Expand Down
Loading