Skip to content

Commit 3ecef85

Browse files
ref: remove usage of CanonicalKeyDict in tests (#71093)
it has no effect in production so I'm removing it <!-- Describe your PR here. -->
1 parent cebc8c7 commit 3ecef85

File tree

6 files changed

+11
-18
lines changed

6 files changed

+11
-18
lines changed

tests/sentry/issues/test_ingest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_new_group_release_env(self) -> None:
119119

120120
def test_different_ids(self) -> None:
121121
create_default_projects()
122-
event_data = load_data("generic-event-profiling").data
122+
event_data = load_data("generic-event-profiling")
123123
project_id = event_data["event"].pop("project_id", self.project.id)
124124
event_data["event"]["timestamp"] = timezone.now().isoformat()
125125
event = self.store_event(data=event_data["event"], project_id=project_id)
@@ -444,7 +444,7 @@ def test_populates_feedback_metadata(self) -> None:
444444
class SaveIssueOccurrenceToEventstreamTest(OccurrenceTestMixin, TestCase):
445445
def test(self) -> None:
446446
create_default_projects()
447-
event_data = load_data("generic-event-profiling").data
447+
event_data = load_data("generic-event-profiling")
448448
project_id = event_data["event"].pop("project_id")
449449
event_data["event"]["timestamp"] = timezone.now().isoformat()
450450
event = self.store_event(data=event_data["event"], project_id=project_id)

tests/sentry/models/test_processingissue.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
)
1010
from sentry.models.rawevent import RawEvent
1111
from sentry.testutils.cases import TestCase
12-
from sentry.utils.canonical import CanonicalKeyDict
1312

1413

1514
class ProcessingIssueTest(TestCase):
@@ -76,7 +75,7 @@ def test_with_release_dist_pair_and_no_previous_issue(self):
7675
raw_event = RawEvent.objects.create(
7776
project_id=project.id,
7877
event_id="abc",
79-
data=CanonicalKeyDict({"release": release.version, "dist": dist.name}),
78+
data={"release": release.version, "dist": dist.name},
8079
)
8180

8281
manager = ProcessingIssueManager()
@@ -112,7 +111,7 @@ def test_with_release_dist_pair_and_previous_issue_without_release_dist(self):
112111
raw_event = RawEvent.objects.create(
113112
project_id=project.id,
114113
event_id="abc",
115-
data=CanonicalKeyDict({"release": release.version, "dist": dist.name}),
114+
data={"release": release.version, "dist": dist.name},
116115
)
117116

118117
ProcessingIssue.objects.create(
@@ -167,7 +166,7 @@ def test_with_release_dist_pair_and_previous_issue_with_release_dist(self):
167166
raw_event = RawEvent.objects.create(
168167
project_id=project.id,
169168
event_id=event_id,
170-
data=CanonicalKeyDict({"release": release, "dist": dist}),
169+
data={"release": release, "dist": dist},
171170
)
172171

173172
manager = ProcessingIssueManager()
@@ -205,7 +204,7 @@ def test_with_release_dist_pair_and_previous_issue_with_same_release_dist(self,
205204
raw_event = RawEvent.objects.create(
206205
project_id=project.id,
207206
event_id="abc",
208-
data=CanonicalKeyDict({"release": release.version, "dist": dist_2.name}),
207+
data={"release": release.version, "dist": dist_2.name},
209208
)
210209

211210
ProcessingIssue.objects.create(

tests/sentry/utils/test_safe.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import pytest
1010

1111
from sentry.testutils.cases import TestCase
12-
from sentry.utils.canonical import CanonicalKeyDict
1312
from sentry.utils.safe import (
1413
get_path,
1514
safe_execute,
@@ -123,7 +122,6 @@ def test_get_path_dict(self):
123122
assert get_path({"a": 2}, "b") is None
124123
assert get_path({"a": {"b": []}}, "a", "b") == []
125124
assert get_path({"a": []}, "a", "b") is None
126-
assert get_path(CanonicalKeyDict({"a": 2}), "a") == 2
127125

128126
def test_get_default(self):
129127
assert get_path({"a": 2}, "b", default=1) == 1
@@ -185,10 +183,6 @@ def test_set_dict(self):
185183
assert set_path(data, "a", "b", value=42)
186184
assert data == {"a": {"b": 42}}
187185

188-
data = CanonicalKeyDict({})
189-
assert set_path(data, "a", value=42)
190-
assert data == {"a": 42}
191-
192186
def test_set_default(self):
193187
data = {"a": {"b": 2}}
194188
assert not setdefault_path(data, "a", "b", value=42)

tests/snuba/api/endpoints/test_organization_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5987,7 +5987,7 @@ def test_all_events_fields(self):
59875987
"user.display": user_data["email"],
59885988
"device": "Mac",
59895989
"os": "",
5990-
"url": event.interfaces.data["request"].full_url,
5990+
"url": event.interfaces["request"].full_url,
59915991
"runtime": dict(event.get_raw_data()["tags"])["runtime"],
59925992
"replayId": replay_id.replace("-", ""),
59935993
"profile.id": profile_id.replace("-", ""),

tests/snuba/api/endpoints/test_organization_events_facets_performance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def store_transaction(
6666
tags = []
6767
if project_id is None:
6868
project_id = self.project.id
69-
event = load_data("transaction").copy()
70-
event.data["tags"].extend(tags)
69+
event = load_data("transaction")
70+
event["tags"].extend(tags)
7171
event.update(
7272
{
7373
"transaction": name,

tests/snuba/api/endpoints/test_organization_events_facets_performance_histogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def store_transaction(
6161
tags = []
6262
if project_id is None:
6363
project_id = self.project.id
64-
event = load_data("transaction").copy()
65-
event.data["tags"].extend(tags)
64+
event = load_data("transaction")
65+
event["tags"].extend(tags)
6666
event.update(
6767
{
6868
"transaction": name,

0 commit comments

Comments
 (0)