Пример #1
0
    def test_doesnt_update_published_app_scopes(self):
        sentry_app = self.create_sentry_app(
            name="sentry", organization=self.org, scopes=("project:read",), published=True
        )
        updater = Updater(sentry_app=sentry_app, user=self.user)
        updater.scopes = ("project:read", "project:write")

        with self.assertRaises(APIError):
            updater.call()
Пример #2
0
 def test_update_webhook_published_app(self):
     sentry_app = self.create_sentry_app(
         name="sentry", organization=self.org, scopes=("project:read",), published=True
     )
     updater = Updater(sentry_app=sentry_app, user=self.user)
     # pass in scopes but as the same value
     updater.scopes = ["project:read"]
     updater.webhook_url = "http://example.com/hooks"
     updater.call()
     assert sentry_app.webhook_url == "http://example.com/hooks"
Пример #3
0
    def test_doesnt_update_published_app_scopes(self):
        sentry_app = self.create_sentry_app(
            name='sentry',
            organization=self.org,
            scopes=('project:read',),
            published=True,
        )
        updater = Updater(sentry_app=sentry_app, user=self.user)
        updater.scopes = ('project:read', 'project:write', )

        with self.assertRaises(APIError):
            updater.call()
Пример #4
0
    def test_doesnt_update_published_app_scopes(self):
        sentry_app = self.create_sentry_app(
            name='sentry',
            organization=self.org,
            scopes=('project:read',),
            published=True,
        )
        updater = Updater(sentry_app=sentry_app)
        updater.scopes = ('project:read', 'project:write', )

        with self.assertRaises(APIError):
            updater.call()
Пример #5
0
 def test_update_scopes_internal_integration(self):
     self.create_project(organization=self.org)
     sentry_app = self.create_internal_integration(
         scopes=("project:read",), organization=self.org
     )
     updater = Updater(sentry_app=sentry_app, user=self.user)
     updater.scopes = ("project:read", "project:write")
     updater.call()
     assert sentry_app.get_scopes() == ["project:read", "project:write"]
     assert ApiToken.objects.get(application=sentry_app.application).get_scopes() == [
         "project:read",
         "project:write",
     ]
Пример #6
0
    def test_doesnt_update_published_app_scopes(self):
        sentry_app = Creator.run(
            name='sentry',
            organization=self.org,
            scopes=('project:read',),
            webhook_url='http://example.com',
        )
        sentry_app.update(status=SentryAppStatus.PUBLISHED)
        updater = Updater(sentry_app=sentry_app)
        updater.scopes = ('project:read', 'project:write', )

        with self.assertRaises(APIError):
            updater.call()