Skip to content

Commit 6178390

Browse files
committed
Test the inclusion of data on list and detail endpoints
1 parent b2fda91 commit 6178390

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest, json
2+
from django.core.urlresolvers import reverse
3+
4+
pytestmark = pytest.mark.django_db
5+
6+
7+
def test_included_data_on_list(single_entry, client):
8+
response = client.get(reverse("entry-list") + '?include=comments')
9+
included = json.loads(response.content).get('included')
10+
11+
assert [x.get('type') for x in included] == ['comments']
12+
13+
def test_included_data_on_detail(single_entry, client):
14+
response = client.get(reverse("entry-detail", kwargs={'pk': single_entry.pk}) + '?include=comments')
15+
included = json.loads(response.content).get('included')
16+
17+
assert [x.get('type') for x in included] == ['comments']
18+

0 commit comments

Comments
 (0)