|
@@ -686,6 +686,60 @@ class DailySummaryTest(
|
|
|
)
|
|
|
assert "higher than last 14d avg" in blocks[3]["fields"][1]["text"]
|
|
|
|
|
|
+ @responses.activate
|
|
|
+ @with_feature("organizations:slack-block-kit")
|
|
|
+ def test_slack_notification_contents_newline(self):
|
|
|
+ type_string = '"""\nTraceback (most recent call last):\nFile /\'/usr/hb/meow/\''
|
|
|
+ data = {
|
|
|
+ "timestamp": iso_format(self.now),
|
|
|
+ "stacktrace": copy.deepcopy(DEFAULT_EVENT_DATA["stacktrace"]),
|
|
|
+ "fingerprint": ["group-5"],
|
|
|
+ "exception": {
|
|
|
+ "values": [
|
|
|
+ {
|
|
|
+ "type": "WorkerLostError",
|
|
|
+ "value": type_string,
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ }
|
|
|
+ self.store_event(
|
|
|
+ data=data,
|
|
|
+ project_id=self.project.id,
|
|
|
+ assert_no_errors=False,
|
|
|
+ )
|
|
|
+ self.store_outcomes(
|
|
|
+ {
|
|
|
+ "org_id": self.organization.id,
|
|
|
+ "project_id": self.project.id,
|
|
|
+ "outcome": Outcome.ACCEPTED,
|
|
|
+ "category": DataCategory.ERROR,
|
|
|
+ "timestamp": self.now,
|
|
|
+ "key_id": 1,
|
|
|
+ },
|
|
|
+ num_times=1,
|
|
|
+ )
|
|
|
+
|
|
|
+ ctx = build_summary_data(
|
|
|
+ timestamp=self.now.timestamp(),
|
|
|
+ duration=ONE_DAY,
|
|
|
+ organization=self.organization,
|
|
|
+ daily=True,
|
|
|
+ )
|
|
|
+ top_projects_context_map = build_top_projects_map(ctx, self.user.id)
|
|
|
+ with self.tasks():
|
|
|
+ DailySummaryNotification(
|
|
|
+ organization=ctx.organization,
|
|
|
+ recipient=self.user,
|
|
|
+ provider=ExternalProviders.SLACK,
|
|
|
+ project_context=top_projects_context_map,
|
|
|
+ ).send()
|
|
|
+ blocks, fallback_text = get_blocks_and_fallback_text()
|
|
|
+ assert (
|
|
|
+ '""" Traceback (most recent call last): File /\'/us...'
|
|
|
+ in blocks[4]["fields"][0]["text"]
|
|
|
+ )
|
|
|
+
|
|
|
@responses.activate
|
|
|
@with_feature("organizations:slack-block-kit")
|
|
|
def test_limit_to_two_projects(self):
|