Skip to content

Commit 3b6c12d

Browse files
committed
Add test to verify empty patch on RelationshipView
1 parent 977e70b commit 3b6c12d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

example/tests/test_views.py

+12
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,18 @@ def test_patch_one_to_many_relationship(self):
143143
response = self.client.get(url)
144144
assert response.data == request_data['data']
145145

146+
def test_patch_one_to_many_relaitonship_with_none(self):
147+
url = '/blogs/{}/relationships/entry_set'.format(self.first_entry.id)
148+
request_data = {
149+
'data': None
150+
}
151+
response = self.client.patch(url, data=request_data)
152+
assert response.status_code == 200, response.content.decode()
153+
assert response.data == []
154+
155+
response = self.client.get(url)
156+
assert response.data == []
157+
146158
def test_patch_many_to_many_relationship(self):
147159
url = '/entries/{}/relationships/authors'.format(self.first_entry.id)
148160
request_data = {

0 commit comments

Comments
 (0)