From 2967a7029adc4b3d0a9e350de72eb86969ef9c04 Mon Sep 17 00:00:00 2001
From: florimondmanca <florimond.manca@gmail.com>
Date: Sat, 16 Jun 2018 21:12:13 +0100
Subject: [PATCH] fix projects tests

---
 tests/test_projects/test_edition_api.py       | 3 ++-
 tests/test_projects/test_participation_api.py | 7 +++++++
 tests/test_projects/test_project_api.py       | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/test_projects/test_edition_api.py b/tests/test_projects/test_edition_api.py
index 48eb535..f8c5dc1 100644
--- a/tests/test_projects/test_edition_api.py
+++ b/tests/test_projects/test_edition_api.py
@@ -12,7 +12,8 @@ class EditionEndpointsTest(SimpleAPITestCase):
     factory = EditionFactory
 
     read_expected_fields = {'id', 'url', 'name', 'year', 'project',
-                            'description', 'organizers', 'participations'}
+                            'description', 'organizers', 'participations',
+                            'edition_form',}
 
     def setUp(self):
         self.factory.create_batch(3)
diff --git a/tests/test_projects/test_participation_api.py b/tests/test_projects/test_participation_api.py
index e882bcd..75422d1 100644
--- a/tests/test_projects/test_participation_api.py
+++ b/tests/test_projects/test_participation_api.py
@@ -5,6 +5,7 @@ from tests.utils import SimpleAPITestCase, logged_in
 
 from projects.factory import EditionFactory, ParticipationFactory
 from users.factory import UserFactory
+from dynamicforms.models import Form
 
 
 class ParticipationReadTest(SimpleAPITestCase):
@@ -58,9 +59,15 @@ class ParticipationCreateTest(SimpleAPITestCase):
     def perform_create(self):
         user = UserFactory.create()
         edition = EditionFactory.create()
+        form = Form.objects.create(title="What's up?")
+        entry = {
+            'form': form.pk,
+            'answers': [],
+        }
         payload = {
             'user': user.pk,
             'edition': edition.pk,
+            'entry': entry,
         }
         return self.client.post('/api/project-participations/',
                                 data=payload, format='json')
diff --git a/tests/test_projects/test_project_api.py b/tests/test_projects/test_project_api.py
index d897abd..6b18a9b 100644
--- a/tests/test_projects/test_project_api.py
+++ b/tests/test_projects/test_project_api.py
@@ -44,7 +44,7 @@ class ProjectEndpointsTest(SimpleAPITestCase):
 
     @logged_in
     def test_retrieve_returns_expected_fields(self):
-        expected = {'id', 'url', 'name', 'logo', 'description'}
+        expected = {'id', 'url', 'name', 'logo', 'description', 'editions'}
         response = self.perform_retrieve()
         self.assertEqual(response.status_code, status.HTTP_200_OK)
         fields = set(response.data)
-- 
GitLab