Пример #1
0
 def test_list(self, api_client, user):
     """List invitations for an organization"""
     organization = OrganizationFactory(admins=[user])
     api_client.force_authenticate(user=user)
     size = 10
     InvitationFactory.create_batch(size, organization=organization)
     response = api_client.get(
         f"/pp-api/organizations/{organization.uuid}/invitations/")
     assert response.status_code == status.HTTP_200_OK
     response_json = json.loads(response.content)
     assert len(response_json["results"]) == size
Пример #2
0
 def test_list_expand_data(self, api_client, user):
     """List invitations for an organization expanding user and org data"""
     organization = OrganizationFactory(admins=[user])
     api_client.force_authenticate(user=user)
     size = 10
     InvitationFactory.create_batch(size,
                                    user=user,
                                    organization=organization)
     response = api_client.get(
         f"/pp-api/organizations/{organization.uuid}/invitations/"
         f"?expand=organization,user")
     assert response.status_code == status.HTTP_200_OK
     response_json = json.loads(response.content)
     assert len(response_json["results"]) == size
     assert "name" in response_json["results"][0]["organization"]
     assert "username" in response_json["results"][0]["user"]