def serialize(self, obj, attrs, user): provider = ExternalTeam.get_provider_string(obj.provider) return { "id": str(obj.id), "teamId": str(obj.team_id), "provider": provider, "externalName": obj.external_name, }
def test_create_existing_association(self): self.external_team = ExternalTeam.objects.create( team_id=str(self.team.id), provider=ExternalTeam.get_provider_enum("github"), external_name="@getsentry/ecosystem", ) data = { "externalName": self.external_team.external_name, "provider": ExternalTeam.get_provider_string(self.external_team.provider), } response = self.client.post(self.url, data) assert response.status_code == 200 assert response.data == { "id": str(self.external_team.id), "teamId": str(self.external_team.team_id), **data, }