Esempio n. 1
0
    def test_sends_resolved_webhook(self, safe_urlopen):
        workflow_notification(self.install.id, self.issue.id, 'resolved', self.user.id)

        assert faux(safe_urlopen).kwarg_equals('url', self.sentry_app.webhook_url)
        assert faux(safe_urlopen).kwarg_equals('data.action', 'resolved', format='json')
        assert faux(safe_urlopen).kwarg_equals('headers.Sentry-Hook-Resource', 'issue')
        assert faux(safe_urlopen).kwarg_equals(
            'data.data.issue.id', six.binary_type(
                self.issue.id), format='json')
Esempio n. 2
0
    def test_sends_resolved_webhook(self, safe_urlopen):
        workflow_notification(self.install.id, self.issue.id, 'resolved', self.user.id)

        assert faux(safe_urlopen).kwarg_equals('url', self.sentry_app.webhook_url)
        assert faux(safe_urlopen).kwarg_equals('data.action', 'resolved', format='json')
        assert faux(safe_urlopen).kwarg_equals('headers.Sentry-Hook-Resource', 'issue')
        assert faux(safe_urlopen).kwarg_equals(
            'data.data.issue.id', six.binary_type(
                self.issue.id), format='json')
Esempio n. 3
0
 def test_does_not_send_if_no_service_hook_exists(self, safe_urlopen):
     sentry_app = self.create_sentry_app(
         name="Another App", organization=self.project.organization, events=[]
     )
     install = self.create_sentry_app_installation(
         organization=self.project.organization, slug=sentry_app.slug
     )
     workflow_notification(install.id, self.issue.id, "assigned", self.user.id)
     assert not safe_urlopen.called
Esempio n. 4
0
    def test_sends_resolved_webhook(self, safe_urlopen):
        workflow_notification(self.install.id, self.issue.id, "resolved", self.user.id)

        assert faux(safe_urlopen).kwarg_equals("url", self.sentry_app.webhook_url)
        assert faux(safe_urlopen).kwarg_equals("data.action", "resolved", format="json")
        assert faux(safe_urlopen).kwarg_equals("headers.Sentry-Hook-Resource", "issue")
        assert faux(safe_urlopen).kwarg_equals(
            "data.data.issue.id", str(self.issue.id), format="json"
        )
Esempio n. 5
0
 def test_does_not_send_if_event_not_in_app_events(self, safe_urlopen):
     sentry_app = self.create_sentry_app(
         name="Another App",
         organization=self.project.organization,
         events=["issue.resolved", "issue.ignored"],
     )
     install = self.create_sentry_app_installation(
         organization=self.project.organization, slug=sentry_app.slug)
     workflow_notification(install.id, self.issue.id, "assigned",
                           self.user.id)
     assert not safe_urlopen.called
Esempio n. 6
0
    def test_sends_resolved_webhook_as_Sentry_without_user(self, safe_urlopen):
        workflow_notification(self.install.id, self.issue.id, "resolved", None)

        assert faux(safe_urlopen).kwarg_equals("data.actor.type",
                                               "application",
                                               format="json")
        assert faux(safe_urlopen).kwarg_equals("data.actor.id",
                                               "sentry",
                                               format="json")
        assert faux(safe_urlopen).kwarg_equals("data.actor.name",
                                               "Sentry",
                                               format="json")
Esempio n. 7
0
 def test_does_not_send_if_event_not_in_app_events(self, safe_urlopen):
     sentry_app = self.create_sentry_app(
         name='Another App',
         organization=self.project.organization,
         events=['issue.resolved', 'issue.ignored'],
     )
     install = self.create_sentry_app_installation(
         organization=self.project.organization,
         slug=sentry_app.slug,
     )
     workflow_notification(install.id, self.issue.id, 'assigned', self.user.id)
     assert not safe_urlopen.called
Esempio n. 8
0
    def test_sends_resolved_webhook_as_Sentry_without_user(self, safe_urlopen):
        workflow_notification(self.install.id, self.issue.id, 'resolved', None)

        assert faux(safe_urlopen).kwarg_equals('data.actor.type',
                                               'application',
                                               format='json')
        assert faux(safe_urlopen).kwarg_equals('data.actor.id',
                                               'sentry',
                                               format='json')
        assert faux(safe_urlopen).kwarg_equals('data.actor.name',
                                               'Sentry',
                                               format='json')
Esempio n. 9
0
    def test_sends_resolved_webhook_as_Sentry_without_user(self, safe_urlopen):
        workflow_notification(self.install.id, self.issue.id, 'resolved', None)

        assert faux(safe_urlopen).kwarg_equals('data.actor.type', 'application', format='json')
        assert faux(safe_urlopen).kwarg_equals('data.actor.id', 'sentry', format='json')
        assert faux(safe_urlopen).kwarg_equals('data.actor.name', 'Sentry', format='json')