|
@@ -7,10 +7,10 @@ from sentry.models import Team
|
|
|
from sentry.testutils import APITestCase
|
|
|
|
|
|
|
|
|
-class TeamIndexTest(APITestCase):
|
|
|
+class OrganizationTeamsListTest(APITestCase):
|
|
|
@fixture
|
|
|
def path(self):
|
|
|
- return reverse('sentry-api-0-team-index')
|
|
|
+ return reverse('sentry-api-0-organization-teams', args=[self.organization.id])
|
|
|
|
|
|
def test_simple(self):
|
|
|
team = self.create_team() # force creation
|
|
@@ -21,24 +21,24 @@ class TeamIndexTest(APITestCase):
|
|
|
assert response.data[0]['id'] == str(team.id)
|
|
|
|
|
|
|
|
|
-class TeamCreateTest(APITestCase):
|
|
|
+class OrganizationTeamsCreateTest(APITestCase):
|
|
|
@fixture
|
|
|
def path(self):
|
|
|
- return reverse('sentry-api-0-team-index')
|
|
|
+ return reverse('sentry-api-0-organization-teams', args=[self.organization.id])
|
|
|
|
|
|
- @patch('sentry.api.endpoints.team_index.can_create_teams', Mock(return_value=False))
|
|
|
+ @patch('sentry.api.endpoints.organization_teams.can_create_teams', Mock(return_value=False))
|
|
|
def test_missing_permission(self):
|
|
|
self.login_as(user=self.user)
|
|
|
resp = self.client.post(self.path)
|
|
|
assert resp.status_code == 403
|
|
|
|
|
|
- @patch('sentry.api.endpoints.team_index.can_create_teams', Mock(return_value=True))
|
|
|
+ @patch('sentry.api.endpoints.organization_teams.can_create_teams', Mock(return_value=True))
|
|
|
def test_missing_params(self):
|
|
|
self.login_as(user=self.user)
|
|
|
resp = self.client.post(self.path)
|
|
|
assert resp.status_code == 400
|
|
|
|
|
|
- @patch('sentry.api.endpoints.team_index.can_create_teams', Mock(return_value=True))
|
|
|
+ @patch('sentry.api.endpoints.organization_teams.can_create_teams', Mock(return_value=True))
|
|
|
def test_valid_params(self):
|
|
|
self.login_as(user=self.user)
|
|
|
|
|
@@ -51,6 +51,7 @@ class TeamCreateTest(APITestCase):
|
|
|
assert team.name == 'hello world'
|
|
|
assert team.slug == 'foobar'
|
|
|
assert team.owner == self.user
|
|
|
+ assert team.organization == self.organization
|
|
|
|
|
|
member_set = list(team.member_set.all())
|
|
|
|
|
@@ -59,7 +60,7 @@ class TeamCreateTest(APITestCase):
|
|
|
assert member.user == team.owner
|
|
|
assert member.type == MEMBER_OWNER
|
|
|
|
|
|
- @patch('sentry.api.endpoints.team_index.can_create_teams', Mock(return_value=True))
|
|
|
+ @patch('sentry.api.endpoints.organization_teams.can_create_teams', Mock(return_value=True))
|
|
|
def test_without_slug(self):
|
|
|
self.login_as(user=self.user)
|
|
|
|
|
@@ -70,7 +71,7 @@ class TeamCreateTest(APITestCase):
|
|
|
team = Team.objects.get(id=resp.data['id'])
|
|
|
assert team.slug == 'hello-world'
|
|
|
|
|
|
- @patch('sentry.api.endpoints.team_index.can_create_teams', Mock(return_value=True))
|
|
|
+ @patch('sentry.api.endpoints.organization_teams.can_create_teams', Mock(return_value=True))
|
|
|
def test_superuser_can_set_owner(self):
|
|
|
self.login_as(user=self.user)
|
|
|
|