コード例 #1
0
ファイル: test_tasks.py プロジェクト: zhangwei0102/sentry
 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)
コード例 #2
0
 def get(self, request: Request) -> Response:
     organization = Organization(slug="myorg")
     user = User(id=1235, name="Hello There")
     incident = Incident(id=2,
                         identifier=123,
                         organization=organization,
                         title="Something broke")
     activity = IncidentActivity(incident=incident,
                                 user=user,
                                 type=IncidentActivityType.COMMENT.value,
                                 comment="hi")
     email = generate_incident_activity_email(activity, user)
     return MailPreview(html_template=email.html_template,
                        text_template=email.template,
                        context=email.context).render(request)
コード例 #3
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)
コード例 #4
0
 def get(self, request):
     organization = Organization(slug='myorg')
     incident = Incident(
         identifier=123,
         organization=organization,
         title='Something broke',
     )
     activity = IncidentActivity(incident=incident,
                                 user=User(name='Hello There'),
                                 type=IncidentActivityType.COMMENT.value,
                                 comment='hi')
     email = generate_incident_activity_email(activity)
     return MailPreview(
         html_template=email.html_template,
         text_template=email.template,
         context=email.context,
     ).render(request)