Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 06612ea

Browse files
committed
Failing test case for errors in RelationshipView.
1 parent 1623942 commit 06612ea

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

example/tests/test_views.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ def test_patch_invalid_entry_relationship_blog_returns_400(self):
7777
content_type='application/vnd.api+json')
7878
assert response.status_code == 400
7979

80+
def test_relationship_view_errors_format(self):
81+
url = '/entries/{}/relationships/blog'.format(self.first_entry.id)
82+
response = self.client.patch(url,
83+
data=json.dumps({'data': {'invalid': ''}}),
84+
content_type='application/vnd.api+json')
85+
assert response.status_code == 400
86+
87+
result = json.loads(response.content.decode('utf-8'))
88+
89+
assert 'data' not in result
90+
assert 'errors' in result
91+
8092
def test_get_empty_to_one_relationship(self):
8193
url = '/comments/{}/relationships/author'.format(self.first_entry.id)
8294
response = self.client.get(url)

0 commit comments

Comments
 (0)