Esempio n. 1
0
 def run_test(
     self, activity, expected_username, expected_action, expected_comment, expected_recipient
 ):
     incident = activity.incident
     context = build_activity_context(activity, expected_recipient)
     assert context["user_name"] == expected_username
     assert context["action"] == "%s on alert %s (#%s)" % (
         expected_action,
         activity.incident.title,
         activity.incident.identifier,
     )
     assert (
         context["link"]
         == absolute_uri(
             reverse(
                 "sentry-metric-alert",
                 kwargs={
                     "organization_slug": incident.organization.slug,
                     "incident_id": incident.identifier,
                 },
             )
         )
         + "?referrer=incident_activity_email"
     )
     assert context["comment"] == expected_comment
Esempio n. 2
0
 def run_test(
     self, activity, expected_username, expected_action, expected_comment, expected_recipient
 ):
     incident = activity.incident
     context = build_activity_context(activity, expected_recipient)
     assert context["user_name"] == expected_username
     assert context["action"] == "%s on incident %s (#%s)" % (
         expected_action,
         activity.incident.title,
         activity.incident.identifier,
     )
     assert (
         context["link"]
         == absolute_uri(
             reverse(
                 "sentry-incident",
                 kwargs={
                     "organization_slug": incident.organization.slug,
                     "incident_id": incident.identifier,
                 },
             )
         )
         + "?referrer=incident_activity_email"
     )
     assert context["comment"] == expected_comment
     assert context["unsubscribe_link"] == generate_signed_link(
         expected_recipient,
         "sentry-account-email-unsubscribe-incident",
         kwargs={"incident_id": incident.id},
     )
Esempio n. 3
0
 def run_test(
     self,
     activity,
     expected_username,
     expected_action,
     expected_comment,
     expected_recipient,
 ):
     incident = activity.incident
     context = build_activity_context(activity, expected_recipient)
     assert context['user_name'] == expected_username
     assert context['action'] == '%s on incident %s (#%s)' % (
         expected_action,
         activity.incident.title,
         activity.incident.identifier,
     )
     assert context['link'] == absolute_uri(
         reverse(
             'sentry-incident',
             kwargs={
                 'organization_slug': incident.organization.slug,
                 'incident_id': incident.identifier,
             },
         )) + '?referrer=incident_activity_email'
     assert context['comment'] == expected_comment
     assert context['unsubscribe_link'] == generate_signed_link(
         expected_recipient,
         'sentry-account-email-unsubscribe-incident',
         kwargs={'incident_id': incident.id},
     )
Esempio n. 4
0
 def test_simple(self):
     activity = create_incident_activity(
         self.incident, IncidentActivityType.COMMENT, user=self.user, comment="hello"
     )
     incident = activity.incident
     recipient = self.create_user()
     message = generate_incident_activity_email(activity, recipient)
     assert message.subject == f"Activity on Alert {incident.title} (#{incident.identifier})"
     assert message.type == "incident.activity"
     assert message.context == build_activity_context(activity, recipient)
Esempio n. 5
0
 def test_simple(self):
     activity = create_incident_activity(
         self.incident,
         IncidentActivityType.COMMENT,
         user=self.user,
         comment='hello',
     )
     incident = activity.incident
     message = generate_incident_activity_email(activity)
     assert message.subject == 'Activity on Incident {} (#{})'.format(
         incident.title,
         incident.identifier,
     )
     assert message.type == 'incident.activity'
     assert message.context == build_activity_context(activity)