|
@@ -4,9 +4,8 @@ from sentry.models import OrganizationMemberTeam, Team, TeamStatus
|
|
from sentry.testutils import SCIMTestCase
|
|
from sentry.testutils import SCIMTestCase
|
|
|
|
|
|
|
|
|
|
-class SCIMGroupDetailsTests(SCIMTestCase):
|
|
|
|
- def test_group_details_404(self):
|
|
|
|
- # test team route 404s
|
|
|
|
|
|
+class SCIMTeamDetailsTests(SCIMTestCase):
|
|
|
|
+ def test_team_details_404(self):
|
|
url = reverse(
|
|
url = reverse(
|
|
"sentry-api-0-organization-scim-team-details",
|
|
"sentry-api-0-organization-scim-team-details",
|
|
args=[self.organization.slug, 2],
|
|
args=[self.organization.slug, 2],
|
|
@@ -21,7 +20,6 @@ class SCIMGroupDetailsTests(SCIMTestCase):
|
|
|
|
|
|
def test_scim_team_details_basic(self):
|
|
def test_scim_team_details_basic(self):
|
|
team = self.create_team(organization=self.organization, name="test-scimv2")
|
|
team = self.create_team(organization=self.organization, name="test-scimv2")
|
|
- # test team details GET
|
|
|
|
url = reverse(
|
|
url = reverse(
|
|
"sentry-api-0-organization-scim-team-details",
|
|
"sentry-api-0-organization-scim-team-details",
|
|
args=[self.organization.slug, team.id],
|
|
args=[self.organization.slug, team.id],
|
|
@@ -36,9 +34,24 @@ class SCIMGroupDetailsTests(SCIMTestCase):
|
|
"meta": {"resourceType": "Group"},
|
|
"meta": {"resourceType": "Group"},
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ def test_scim_team_details_excluded_attributes(self):
|
|
|
|
+ team = self.create_team(organization=self.organization, name="test-scimv2")
|
|
|
|
+ url = reverse(
|
|
|
|
+ "sentry-api-0-organization-scim-team-details",
|
|
|
|
+ args=[self.organization.slug, team.id],
|
|
|
|
+ )
|
|
|
|
+ response = self.client.get(f"{url}?excludedAttributes=members")
|
|
|
|
+ assert response.status_code == 200, response.content
|
|
|
|
+ assert response.data == {
|
|
|
|
+ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
|
|
|
|
+ "id": str(team.id),
|
|
|
|
+ "displayName": "test-scimv2",
|
|
|
|
+ "members": None,
|
|
|
|
+ "meta": {"resourceType": "Group"},
|
|
|
|
+ }
|
|
|
|
+
|
|
def test_scim_team_details_patch_replace_rename_team(self):
|
|
def test_scim_team_details_patch_replace_rename_team(self):
|
|
team = self.create_team(organization=self.organization)
|
|
team = self.create_team(organization=self.organization)
|
|
- # rename a team with the replace op
|
|
|
|
url = reverse(
|
|
url = reverse(
|
|
"sentry-api-0-organization-scim-team-details", args=[self.organization.slug, team.id]
|
|
"sentry-api-0-organization-scim-team-details", args=[self.organization.slug, team.id]
|
|
)
|
|
)
|
|
@@ -104,8 +117,6 @@ class SCIMGroupDetailsTests(SCIMTestCase):
|
|
team_id=str(team.id), organizationmember_id=member1.id
|
|
team_id=str(team.id), organizationmember_id=member1.id
|
|
).exists()
|
|
).exists()
|
|
|
|
|
|
- # remove a member from a team
|
|
|
|
-
|
|
|
|
def test_scim_team_details_patch_remove(self):
|
|
def test_scim_team_details_patch_remove(self):
|
|
team = self.create_team(organization=self.organization)
|
|
team = self.create_team(organization=self.organization)
|
|
member1 = self.create_member(
|
|
member1 = self.create_member(
|