@@ -55,7 +55,7 @@ def test_create_destruction_list(self):
55
55
"name" : "A test list" ,
56
56
"contains_sensitive_info" : True ,
57
57
"reviewer" : {"user" : reviewer .pk },
58
- "items " : [
58
+ "add " : [
59
59
{
60
60
"zaak" : "http://localhost:8003/zaken/api/v1/zaken/111-111-111" ,
61
61
"extra_zaak_data" : {},
@@ -139,7 +139,7 @@ def test_zaak_already_included_in_other_list(self):
139
139
"assignees" : [
140
140
{"user" : reviewer .pk , "order" : 0 },
141
141
],
142
- "items " : [
142
+ "add " : [
143
143
{
144
144
"zaak" : "http://localhost:8003/zaken/api/v1/zaken/111-111-111" ,
145
145
"extra_zaak_data" : {},
@@ -157,7 +157,7 @@ def test_zaak_already_included_in_other_list(self):
157
157
158
158
self .assertFalse (serializer .is_valid ())
159
159
self .assertEqual (
160
- serializer .errors ["items " ][0 ]["zaak" ],
160
+ serializer .errors ["add " ][0 ]["zaak" ],
161
161
[
162
162
_ (
163
163
"This case was already included in another destruction list and was not exempt during the review process."
@@ -189,7 +189,7 @@ def test_zaak_already_included_in_other_list_but_exempt(self):
189
189
"name" : "A test list" ,
190
190
"contains_sensitive_info" : True ,
191
191
"reviewer" : {"user" : reviewer .pk },
192
- "items " : [
192
+ "add " : [
193
193
{
194
194
"zaak" : "http://localhost:8003/zaken/api/v1/zaken/111-111-111" ,
195
195
"extra_zaak_data" : {},
@@ -226,7 +226,7 @@ def test_full_list_update(self):
226
226
data = {
227
227
"name" : "An updated test list" ,
228
228
"contains_sensitive_info" : False ,
229
- "items " : [
229
+ "add " : [
230
230
{
231
231
"zaak" : "http://localhost:8003/zaken/api/v1/zaken/111-111-111" ,
232
232
},
@@ -249,7 +249,7 @@ def test_full_list_update(self):
249
249
250
250
items = destruction_list .items .all ()
251
251
252
- self .assertEqual (items .count (), 1 )
252
+ self .assertEqual (items .count (), 3 )
253
253
254
254
logs = TimelineLog .objects .filter (
255
255
template = "logging/destruction_list_updated.txt"
@@ -401,10 +401,12 @@ def test_partial_update_with_zaken(self):
401
401
status = ListItemStatus .suggested ,
402
402
with_zaak = True ,
403
403
)
404
+ zaak = ZaakFactory .create ()
404
405
405
406
# We are removing 2 zaken from the destruction list
406
407
data = {
407
- "items" : [{"zaak" : items [0 ].zaak .url }, {"zaak" : items [1 ].zaak .url }],
408
+ "add" : [{"zaak" : zaak .url }],
409
+ "remove" : [{"zaak" : items [0 ].zaak .url }, {"zaak" : items [1 ].zaak .url }],
408
410
}
409
411
410
412
record_manager = UserFactory .create (post__can_start_destruction = True )
@@ -417,17 +419,22 @@ def test_partial_update_with_zaken(self):
417
419
partial = True ,
418
420
context = {"request" : request },
419
421
)
420
-
421
422
self .assertTrue (serializer .is_valid ())
422
423
423
424
serializer .save ()
424
425
425
- items = DestructionListItem .objects .filter (destruction_list = destruction_list )
426
- items_in_list = items .values_list ("zaak__url" , flat = True )
426
+ destruction_list_items = DestructionListItem .objects .filter (
427
+ destruction_list = destruction_list
428
+ )
429
+ items_in_list = destruction_list_items .values_list ("zaak__url" , flat = True )
427
430
428
- self .assertEqual (items_in_list .count (), 2 )
429
- self .assertIn (data ["items" ][0 ]["zaak" ], items_in_list )
430
- self .assertIn (data ["items" ][1 ]["zaak" ], items_in_list )
431
+ self .assertEqual (items_in_list .count (), 3 )
432
+ self .assertNotIn (items , items_in_list )
433
+ self .assertIn (items [2 ].zaak .url , items_in_list )
434
+ self .assertIn (items [3 ].zaak .url , items_in_list )
435
+ self .assertIn (data ["add" ][0 ]["zaak" ], items_in_list )
436
+ self .assertNotIn (data ["remove" ][0 ]["zaak" ], items_in_list )
437
+ self .assertNotIn (data ["remove" ][1 ]["zaak" ], items_in_list )
431
438
432
439
@tag ("gh-122" )
433
440
def test_assign_author_as_reviewer (self ):
@@ -603,7 +610,7 @@ def test_no_bulk_select_and_no_items(self):
603
610
self .assertFalse (is_valid )
604
611
self .assertEqual (
605
612
serializer .errors ["non_field_errors" ][0 ],
606
- "Neither the 'items ' nor the 'select_all' field have been specified." ,
613
+ "Neither the 'add ' nor the 'select_all' field have been specified." ,
607
614
)
608
615
609
616
def test_zaak_filters_validation (self ):
0 commit comments