|
@@ -7,20 +7,43 @@ from sentry.testutils import APITestCase
|
|
|
|
|
|
|
|
|
class OrganizationPluginsTest(APITestCase):
|
|
|
- def test_exposes_plugins_across_all_org_projects(self):
|
|
|
- projectA = self.create_project()
|
|
|
- projectB = self.create_project(organization=projectA.organization)
|
|
|
+ def setUp(self):
|
|
|
+ self.projectA = self.create_project()
|
|
|
+ self.projectB = self.create_project(organization=self.projectA.organization)
|
|
|
|
|
|
- plugins.get('webhooks').enable(projectA)
|
|
|
- plugins.get('mail').enable(projectB)
|
|
|
+ plugins.get('webhooks').enable(self.projectA)
|
|
|
+ plugins.get('mail').enable(self.projectB)
|
|
|
|
|
|
self.login_as(user=self.user)
|
|
|
|
|
|
+ def test_exposes_plugins_across_all_org_projects(self):
|
|
|
+ url = reverse(
|
|
|
+ 'sentry-api-0-organization-plugins',
|
|
|
+ kwargs={'organization_slug': self.projectA.organization.slug}
|
|
|
+ )
|
|
|
+
|
|
|
+ url = u'{}?{}'.format(url, 'plugins=mail&plugins=webhooks')
|
|
|
+
|
|
|
+ response = self.client.get(url)
|
|
|
+
|
|
|
+ assert response.status_code == 200, \
|
|
|
+ (response.status_code, response.content)
|
|
|
+
|
|
|
+ enabled_plugins = [
|
|
|
+ (p['project']['id'], p['slug']) for p in
|
|
|
+ filter(lambda p: p['enabled'], response.data)
|
|
|
+ ]
|
|
|
+
|
|
|
+ assert (self.projectA.id, 'webhooks') in enabled_plugins
|
|
|
+ assert (self.projectB.id, 'mail') in enabled_plugins
|
|
|
+
|
|
|
+ def test_exposes_specific_plugins_across_all_org_projects(self):
|
|
|
url = reverse(
|
|
|
'sentry-api-0-organization-plugins',
|
|
|
- kwargs={'organization_slug': projectA.organization.slug}
|
|
|
+ kwargs={'organization_slug': self.projectA.organization.slug}
|
|
|
)
|
|
|
|
|
|
+ url = '{}?plugins=mail'.format(url)
|
|
|
response = self.client.get(url)
|
|
|
|
|
|
assert response.status_code == 200, \
|
|
@@ -31,5 +54,5 @@ class OrganizationPluginsTest(APITestCase):
|
|
|
filter(lambda p: p['enabled'], response.data)
|
|
|
]
|
|
|
|
|
|
- assert (projectA.id, 'webhooks') in enabled_plugins
|
|
|
- assert (projectB.id, 'mail') in enabled_plugins
|
|
|
+ assert (self.projectA.id, 'webhooks') not in enabled_plugins
|
|
|
+ assert (self.projectB.id, 'mail') in enabled_plugins
|