Skip to content
Snippets Groups Projects
Commit 2967a702 authored by florimondmanca's avatar florimondmanca
Browse files

fix projects tests

parent 38e5f5b9
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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')
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment