@@ -135,6 +135,26 @@ def test_patch_one_to_many_relationship(self):
135
135
response = self .client .get (url )
136
136
assert response .data == request_data ['data' ]
137
137
138
+ # retry a second time should end up with same result
139
+ response = self .client .patch (url , data = request_data )
140
+ assert response .status_code == 200 , response .content .decode ()
141
+ assert response .data == request_data ['data' ]
142
+
143
+ response = self .client .get (url )
144
+ assert response .data == request_data ['data' ]
145
+
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
+
138
158
def test_patch_many_to_many_relationship (self ):
139
159
url = '/entries/{}/relationships/authors' .format (self .first_entry .id )
140
160
request_data = {
@@ -152,6 +172,14 @@ def test_patch_many_to_many_relationship(self):
152
172
response = self .client .get (url )
153
173
assert response .data == request_data ['data' ]
154
174
175
+ # retry a second time should end up with same result
176
+ response = self .client .patch (url , data = request_data )
177
+ assert response .status_code == 200 , response .content .decode ()
178
+ assert response .data == request_data ['data' ]
179
+
180
+ response = self .client .get (url )
181
+ assert response .data == request_data ['data' ]
182
+
155
183
def test_post_to_one_relationship_should_fail (self ):
156
184
url = '/entries/{}/relationships/blog' .format (self .first_entry .id )
157
185
request_data = {
0 commit comments