예제 #1
0
 def test_email_failure_content(self, builder):
     with self.tasks():
         self.data_export.email_failure(self.TEST_STRING)
     expected_email_args = {
         "subject": "We couldn't export your data.",
         "context": {
             "creation": ExportedData.format_date(date=self.data_export.date_added),
             "error_message": self.TEST_STRING,
             "payload": json.dumps(self.data_export.payload, indent=2, sort_keys=True),
         },
         "type": "organization.export-data",
         "template": "sentry/emails/data-export-failure.txt",
         "html_template": "sentry/emails/data-export-failure.html",
     }
     builder.assert_called_with(**expected_email_args)
예제 #2
0
 def test_email_success_content(self, builder):
     self.data_export.finalize_upload(file=self.file1)
     with self.tasks():
         self.data_export.email_success()
     expected_url = absolute_uri(
         reverse("sentry-data-export-details",
                 args=[self.organization.slug, self.data_export.id]))
     expected_email_args = {
         "subject": "Your data is ready.",
         "context": {
             "url":
             expected_url,
             "expiration":
             ExportedData.format_date(date=self.data_export.date_expired),
         },
         "type": "organization.export-data",
         "template": "sentry/emails/data-export-success.txt",
         "html_template": "sentry/emails/data-export-success.html",
     }
     builder.assert_called_with(**expected_email_args)
예제 #3
0
 def test_format_date(self):
     assert ExportedData.format_date(self.data_export.date_finished) is None
     assert isinstance(
         ExportedData.format_date(self.data_export.date_added),
         six.binary_type)