Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: revert Activity.data assertions #73786

Merged
merged 1 commit into from
Jul 3, 2024
Merged
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
4 changes: 0 additions & 4 deletions tests/sentry/api/endpoints/test_group_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def test_note_merge(self):
data={"text": "This looks bad :)"},
datetime=now - datetime.timedelta(days=70),
)
assert note1.data is not None
note2 = Activity.objects.create(
group=group1,
project=project1,
Expand All @@ -61,7 +60,6 @@ def test_note_merge(self):
data={"text": "Yeah we should probably look into this"},
datetime=now - datetime.timedelta(days=66),
)
assert note2.data is not None

project2 = self.create_project()
group2 = self.create_group(project2)
Expand All @@ -74,7 +72,6 @@ def test_note_merge(self):
data={"text": "I have been a good Sentry :)"},
datetime=now - datetime.timedelta(days=90),
)
assert note3.data is not None
note4 = Activity.objects.create(
group=group2,
project=project2,
Expand All @@ -83,7 +80,6 @@ def test_note_merge(self):
data={"text": "You have been a bad user :)"},
datetime=now - datetime.timedelta(days=88),
)
assert note4.data is not None

with self.tasks():
merge_groups([group1.id], group2.id)
Expand Down
10 changes: 0 additions & 10 deletions tests/sentry/event_manager/test_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ def test_marks_as_unresolved_with_new_release(
assert group.status == GroupStatus.RESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == ""

assert GroupResolution.objects.filter(group=group).exists()
Expand All @@ -372,7 +371,6 @@ def test_marks_as_unresolved_with_new_release(
assert group.status == GroupStatus.UNRESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == "b"

assert not GroupResolution.objects.filter(group=group).exists()
Expand Down Expand Up @@ -433,13 +431,11 @@ def test_that_release_in_latest_activity_prior_to_regression_is_not_overridden(
assert group.status == GroupStatus.UNRESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == "foobar"

regressed_activity = Activity.objects.get(
group=group, type=ActivityType.SET_REGRESSION.value
)
assert regressed_activity.data is not None
assert regressed_activity.data["version"] == "b"
assert regressed_activity.data["follows_semver"] is False

Expand Down Expand Up @@ -497,14 +493,12 @@ def test_current_release_version_in_latest_activity_prior_to_regression_is_not_o
assert group.status == GroupStatus.UNRESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == "b"
assert activity.data["current_release_version"] == "pre foobar"

regressed_activity = Activity.objects.get(
group=group, type=ActivityType.SET_REGRESSION.value
)
assert regressed_activity.data is not None
assert regressed_activity.data["version"] == "b"

mock_send_activity_notifications_delay.assert_called_once_with(regressed_activity.id)
Expand Down Expand Up @@ -561,13 +555,11 @@ def test_resolved_in_release_regression_activity_follows_semver(
assert group.status == GroupStatus.UNRESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == "[email protected]"

regressed_activity = Activity.objects.get(
group=group, type=ActivityType.SET_REGRESSION.value
)
assert regressed_activity.data is not None
assert regressed_activity.data["version"] == "[email protected]"
assert regressed_activity.data["follows_semver"] is True
assert regressed_activity.data["resolved_in_version"] == "[email protected]"
Expand Down Expand Up @@ -843,7 +835,6 @@ def test_marks_as_unresolved_with_new_release_with_integration(
assert group.status == GroupStatus.RESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == ""

assert GroupResolution.objects.filter(group=group).exists()
Expand All @@ -862,7 +853,6 @@ def test_marks_as_unresolved_with_new_release_with_integration(
assert group.status == GroupStatus.UNRESOLVED

activity = Activity.objects.get(id=activity.id)
assert activity.data is not None
assert activity.data["version"] == "b"

assert not GroupResolution.objects.filter(group=group).exists()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def test_note(self, mock_send_card: MagicMock):
f"[{self.group.title}](http://testserver/organizations/{self.organization.slug}/issues/{self.group.id}/?referrer=note\\_activity-msteams&notification\\_uuid="
in body[1]["text"]
)
assert notification.activity.data is not None
assert notification.activity.data["text"] == body[2]["text"]
notification_uuid = self.get_notification_uuid(body[3]["columns"][1]["items"][0]["text"])
assert (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_resolved_in_release(self, mock_send_card):
body = args[1]["body"]
assert 4 == len(body)

assert notification.activity.data is not None
release_name = notification.activity.data["version"]
assert (
f"Issue marked as resolved in {release_name} by {self.user.get_display_name()}"
Expand Down
10 changes: 0 additions & 10 deletions tests/sentry/issues/endpoints/test_organization_group_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4112,7 +4112,6 @@ def test_self_assign_issue_next_release(self) -> None:
activity = Activity.objects.get(
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
)
assert activity.data is not None
assert activity.data["version"] == ""
with assume_test_silo_mode(SiloMode.CONTROL):
uo1.delete()
Expand Down Expand Up @@ -4179,7 +4178,6 @@ def test_in_semver_projects_group_resolution_stores_current_release_version(self
ident=grp_resolution.id,
)

assert activity.data is not None
assert activity.data["current_release_version"] == release_2.version

def test_in_non_semver_projects_group_resolution_stores_current_release_version(self) -> None:
Expand Down Expand Up @@ -4329,7 +4327,6 @@ def test_in_non_semver_projects_resolved_in_next_release_is_equated_to_in_releas
type=ActivityType.SET_RESOLVED_IN_RELEASE.value,
ident=grp_resolution.id,
)
assert activity.data is not None
assert activity.data["version"] == release_2.version

def test_selective_status_update(self) -> None:
Expand Down Expand Up @@ -4399,7 +4396,6 @@ def test_set_resolved_in_current_release(self) -> None:
activity = Activity.objects.get(
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
)
assert activity.data is not None
assert activity.data["version"] == release.version
assert GroupHistory.objects.filter(
group=group, status=GroupHistoryStatus.SET_RESOLVED_IN_RELEASE
Expand Down Expand Up @@ -4441,7 +4437,6 @@ def test_set_resolved_in_explicit_release(self) -> None:
activity = Activity.objects.get(
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
)
assert activity.data is not None
assert activity.data["version"] == release.version

def test_in_semver_projects_set_resolved_in_explicit_release(self) -> None:
Expand Down Expand Up @@ -4486,7 +4481,6 @@ def test_in_semver_projects_set_resolved_in_explicit_release(self) -> None:
activity = Activity.objects.get(
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
)
assert activity.data is not None
assert activity.data["version"] == release_1.version

assert GroupResolution.has_resolution(group=group, release=release_2)
Expand Down Expand Up @@ -4524,7 +4518,6 @@ def test_set_resolved_in_next_release(self) -> None:
activity = Activity.objects.get(
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
)
assert activity.data is not None
assert activity.data["version"] == ""

def test_set_resolved_in_next_release_legacy(self) -> None:
Expand Down Expand Up @@ -4562,7 +4555,6 @@ def test_set_resolved_in_next_release_legacy(self) -> None:
activity = Activity.objects.get(
group=group, type=ActivityType.SET_RESOLVED_IN_RELEASE.value
)
assert activity.data is not None
assert activity.data["version"] == ""

def test_set_resolved_in_explicit_commit_unreleased(self) -> None:
Expand Down Expand Up @@ -4595,7 +4587,6 @@ def test_set_resolved_in_explicit_commit_unreleased(self) -> None:
).exists()

activity = Activity.objects.get(group=group, type=ActivityType.SET_RESOLVED_IN_COMMIT.value)
assert activity.data is not None
assert activity.data["commit"] == commit.id
assert GroupHistory.objects.filter(
group=group, status=GroupHistoryStatus.SET_RESOLVED_IN_COMMIT
Expand Down Expand Up @@ -4634,7 +4625,6 @@ def test_set_resolved_in_explicit_commit_released(self) -> None:
).exists()

activity = Activity.objects.get(group=group, type=ActivityType.SET_RESOLVED_IN_COMMIT.value)
assert activity.data is not None
assert activity.data["commit"] == commit.id

resolution = GroupResolution.objects.get(group=group)
Expand Down
2 changes: 0 additions & 2 deletions tests/sentry/issues/test_status_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def test_ignore_new_issue(self, issue_ignored: Any) -> None:

assert issue_ignored.called
activity = Activity.objects.get(group=self.group, type=ActivityType.SET_IGNORED.value)
assert activity.data is not None
assert activity.data.get("ignoreDuration") == 30

assert GroupHistory.objects.filter(
Expand All @@ -107,7 +106,6 @@ def test_ignore_until_escalating(self, issue_ignored: Any) -> None:

assert issue_ignored.called
activity = Activity.objects.get(group=self.group, type=ActivityType.SET_IGNORED.value)
assert activity.data is not None
assert activity.data.get("ignoreUntilEscalating")

assert GroupHistory.objects.filter(
Expand Down
2 changes: 0 additions & 2 deletions tests/sentry/models/test_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def test_get_activities_for_group_priority(self):
assert act_for_group[0] == activities[-1]
assert act_for_group[1] == activities[-2]
assert act_for_group[-1].type == ActivityType.FIRST_SEEN.value
assert act_for_group[-1].data is not None
assert act_for_group[-1].data["priority"] == PriorityLevel.HIGH.to_str()

def test_get_activities_for_group_simple_priority_ff_on_dups(self):
Expand Down Expand Up @@ -91,7 +90,6 @@ def test_get_activities_for_group_simple_priority_ff_on_dups(self):
assert act_for_group[0] == activities[-1]
assert act_for_group[1] == activities[-2]
assert act_for_group[-1].type == ActivityType.FIRST_SEEN.value
assert act_for_group[-1].data is not None
assert act_for_group[-1].data["priority"] == PriorityLevel.HIGH.to_str()

def test_get_activities_for_group_simple(self):
Expand Down
2 changes: 0 additions & 2 deletions tests/sentry/models/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def test_no_commits_no_head_commits(self):
activity = Activity.objects.get(
type=ActivityType.DEPLOY.value, project=project, ident=release.version
)
assert activity.data is not None
assert activity.data["deploy_id"] == deploy.id
assert Deploy.objects.get(id=deploy.id).notified is True

Expand Down Expand Up @@ -113,6 +112,5 @@ def test_no_commits_fetch_complete(self):
activity = Activity.objects.get(
type=ActivityType.DEPLOY.value, project=project, ident=release.version
)
assert activity.data is not None
assert activity.data["deploy_id"] == deploy.id
assert Deploy.objects.get(id=deploy.id).notified is True
7 changes: 0 additions & 7 deletions tests/sentry/models/test_groupassignee.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_assign_user(self):
project=self.group.project, group=self.group, type=ActivityType.ASSIGNED.value
)

assert activity.data is not None
assert activity.data["assignee"] == str(self.user.id)
assert activity.data["assigneeEmail"] == self.user.email
assert activity.data["assigneeType"] == "user"
Expand All @@ -57,7 +56,6 @@ def test_assign_team(self):
project=self.group.project, group=self.group, type=ActivityType.ASSIGNED.value
)

assert activity.data is not None
assert activity.data["assignee"] == str(self.team.id)
assert activity.data["assigneeEmail"] is None
assert activity.data["assigneeType"] == "team"
Expand All @@ -72,7 +70,6 @@ def test_create_only(self):
activity = Activity.objects.get(
project=self.group.project, group=self.group, type=ActivityType.ASSIGNED.value
)
assert activity.data is not None
assert activity.data["assignee"] == str(self.user.id)
assert activity.data["assigneeEmail"] == self.user.email
assert activity.data["assigneeType"] == "user"
Expand All @@ -88,7 +85,6 @@ def test_create_only(self):
activity = Activity.objects.get(
project=self.group.project, group=self.group, type=ActivityType.ASSIGNED.value
)
assert activity.data is not None
assert activity.data["assignee"] == str(self.user.id)
assert activity.data["assigneeEmail"] == self.user.email
assert activity.data["assigneeType"] == "user"
Expand All @@ -112,12 +108,10 @@ def test_reassign_user_to_team(self):
).order_by("id")
)

assert activity[0].data is not None
assert activity[0].data["assignee"] == str(self.user.id)
assert activity[0].data["assigneeEmail"] == self.user.email
assert activity[0].data["assigneeType"] == "user"

assert activity[1].data is not None
assert activity[1].data["assignee"] == str(self.team.id)
assert activity[1].data["assigneeEmail"] is None
assert activity[1].data["assigneeType"] == "team"
Expand Down Expand Up @@ -171,7 +165,6 @@ def test_assignee_sync_outbound_assign(self, mock_sync_assignee_outbound):
project=self.group.project, group=self.group, type=ActivityType.ASSIGNED.value
)

assert activity.data is not None
assert activity.data["assignee"] == str(self.user.id)
assert activity.data["assigneeEmail"] == self.user.email
assert activity.data["assigneeType"] == "user"
Expand Down
2 changes: 0 additions & 2 deletions tests/sentry/tasks/test_clear_expired_resolutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ def test_simple(self):
assert resolution2.status == GroupResolution.Status.pending

activity1 = Activity.objects.get(id=activity1.id)
assert activity1.data is not None
assert activity1.data["version"] == new_release.version

activity2 = Activity.objects.get(id=activity2.id)
assert activity2.data is not None
assert activity2.data["version"] == ""
1 change: 0 additions & 1 deletion tests/sentry/tasks/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_simple(self):

activity = Activity.objects.get(group=group, type=ActivityType.NOTE.value)
assert activity.user_id == self.user.id
assert activity.data is not None
assert activity.data["text"] == "hello world!"

def test_handle_unknown_address(self):
Expand Down
1 change: 0 additions & 1 deletion tests/sentry/tasks/test_sentry_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ def setUp(self):
user_id=self.user.id,
data={"text": "hello world"},
)
assert self.note.data is not None
self.data = {
"comment_id": self.note.id,
"timestamp": self.note.datetime,
Expand Down
1 change: 0 additions & 1 deletion tests/snuba/api/endpoints/test_group_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ def test_group_post_priority(self):
assert act_for_group[0].type == ActivityType.SET_PRIORITY.value
assert act_for_group[-1].type == ActivityType.FIRST_SEEN.value
assert act_for_group[0].user_id == self.user.id
assert act_for_group[0].data is not None
assert act_for_group[0].data["priority"] == "high"

get_response_after = self.client.get(url, format="json")
Expand Down
Loading
Loading