@@ -858,7 +858,7 @@ def test_filter_items_on_destruction_list(self):
858
858
859
859
self .client .force_authenticate (user = record_manager )
860
860
endpoint = furl (reverse ("api:destruction-list-items-list" ))
861
- endpoint .args ["destruction_list" ] = destruction_list .pk
861
+ endpoint .args ["destruction_list" ] = str ( destruction_list .uuid )
862
862
863
863
response = self .client .get (
864
864
endpoint .url ,
@@ -870,6 +870,41 @@ def test_filter_items_on_destruction_list(self):
870
870
871
871
self .assertEqual (data ["count" ], 2 )
872
872
873
+ def test_order_on_processing_status (self ):
874
+ record_manager = UserFactory .create (username = "record_manager" )
875
+ destruction_list = DestructionListFactory .create ()
876
+ item1 = DestructionListItemFactory .create (
877
+ status = ListItemStatus .suggested ,
878
+ destruction_list = destruction_list ,
879
+ processing_status = InternalStatus .succeeded ,
880
+ )
881
+ item2 = DestructionListItemFactory .create (
882
+ status = ListItemStatus .suggested ,
883
+ destruction_list = destruction_list ,
884
+ processing_status = InternalStatus .processing ,
885
+ )
886
+ item3 = DestructionListItemFactory .create (
887
+ status = ListItemStatus .suggested ,
888
+ destruction_list = destruction_list ,
889
+ processing_status = InternalStatus .failed ,
890
+ )
891
+
892
+ self .client .force_authenticate (user = record_manager )
893
+ endpoint = furl (reverse ("api:destruction-list-items-list" ))
894
+ endpoint .args ["destruction_list" ] = str (destruction_list .uuid )
895
+
896
+ response = self .client .get (
897
+ endpoint .url ,
898
+ )
899
+
900
+ self .assertEqual (response .status_code , status .HTTP_200_OK )
901
+
902
+ data = response .json ()
903
+
904
+ self .assertEqual (data ["results" ][0 ]["pk" ], item3 .pk )
905
+ self .assertEqual (data ["results" ][1 ]["pk" ], item2 .pk )
906
+ self .assertEqual (data ["results" ][2 ]["pk" ], item1 .pk )
907
+
873
908
874
909
class DestructionListReviewViewSetTest (APITestCase ):
875
910
def test_no_auth (self ):
0 commit comments