@@ -512,7 +512,7 @@ def test_requester_is_no_admin(self, method: str, url: str):
512
512
access_token = self .other_user_tok ,
513
513
)
514
514
515
- self .assertEqual (403 , channel .code , msg = channel .json_body )
515
+ self .assertEqual (HTTPStatus . FORBIDDEN , channel .code , msg = channel .json_body )
516
516
self .assertEqual (Codes .FORBIDDEN , channel .json_body ["errcode" ])
517
517
518
518
@parameterized .expand (
@@ -534,7 +534,7 @@ def test_room_does_not_exist(self, method: str, url: str):
534
534
access_token = self .admin_user_tok ,
535
535
)
536
536
537
- self .assertEqual (404 , channel .code , msg = channel .json_body )
537
+ self .assertEqual (HTTPStatus . NOT_FOUND , channel .code , msg = channel .json_body )
538
538
self .assertEqual (Codes .NOT_FOUND , channel .json_body ["errcode" ])
539
539
540
540
@parameterized .expand (
@@ -555,7 +555,7 @@ def test_room_is_not_valid(self, method: str, url: str):
555
555
access_token = self .admin_user_tok ,
556
556
)
557
557
558
- self .assertEqual (400 , channel .code , msg = channel .json_body )
558
+ self .assertEqual (HTTPStatus . BAD_REQUEST , channel .code , msg = channel .json_body )
559
559
self .assertEqual (
560
560
"invalidroom is not a legal room ID" ,
561
561
channel .json_body ["error" ],
@@ -573,7 +573,7 @@ def test_new_room_user_does_not_exist(self):
573
573
access_token = self .admin_user_tok ,
574
574
)
575
575
576
- self .assertEqual (200 , channel .code , msg = channel .json_body )
576
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
577
577
self .assertIn ("purge_id" , channel .json_body )
578
578
purge_id = channel .json_body ["purge_id" ]
579
579
@@ -591,7 +591,7 @@ def test_new_room_user_is_not_local(self):
591
591
access_token = self .admin_user_tok ,
592
592
)
593
593
594
- self .assertEqual (400 , channel .code , msg = channel .json_body )
594
+ self .assertEqual (HTTPStatus . BAD_REQUEST , channel .code , msg = channel .json_body )
595
595
self .assertEqual (
596
596
"User must be our own: @not:exist.bla" ,
597
597
channel .json_body ["error" ],
@@ -609,7 +609,7 @@ def test_block_is_not_bool(self):
609
609
access_token = self .admin_user_tok ,
610
610
)
611
611
612
- self .assertEqual (400 , channel .code , msg = channel .json_body )
612
+ self .assertEqual (HTTPStatus . BAD_REQUEST , channel .code , msg = channel .json_body )
613
613
self .assertEqual (Codes .BAD_JSON , channel .json_body ["errcode" ])
614
614
615
615
def test_purge_is_not_bool (self ):
@@ -624,7 +624,7 @@ def test_purge_is_not_bool(self):
624
624
access_token = self .admin_user_tok ,
625
625
)
626
626
627
- self .assertEqual (400 , channel .code , msg = channel .json_body )
627
+ self .assertEqual (HTTPStatus . BAD_REQUEST , channel .code , msg = channel .json_body )
628
628
self .assertEqual (Codes .BAD_JSON , channel .json_body ["errcode" ])
629
629
630
630
def test_delete_expired_status (self ):
@@ -638,7 +638,7 @@ def test_delete_expired_status(self):
638
638
access_token = self .admin_user_tok ,
639
639
)
640
640
641
- self .assertEqual (200 , channel .code , msg = channel .json_body )
641
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
642
642
self .assertIn ("purge_id" , channel .json_body )
643
643
purge_id1 = channel .json_body ["purge_id" ]
644
644
@@ -653,7 +653,7 @@ def test_delete_expired_status(self):
653
653
access_token = self .admin_user_tok ,
654
654
)
655
655
656
- self .assertEqual (200 , channel .code , msg = channel .json_body )
656
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
657
657
self .assertIn ("purge_id" , channel .json_body )
658
658
purge_id2 = channel .json_body ["purge_id" ]
659
659
@@ -664,7 +664,7 @@ def test_delete_expired_status(self):
664
664
access_token = self .admin_user_tok ,
665
665
)
666
666
667
- self .assertEqual (200 , channel .code , msg = channel .json_body )
667
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
668
668
self .assertEqual (2 , len (channel .json_body ["results" ]))
669
669
self .assertEqual ("complete" , channel .json_body ["results" ][0 ]["status" ])
670
670
self .assertEqual ("complete" , channel .json_body ["results" ][1 ]["status" ])
@@ -681,7 +681,7 @@ def test_delete_expired_status(self):
681
681
access_token = self .admin_user_tok ,
682
682
)
683
683
684
- self .assertEqual (200 , channel .code , msg = channel .json_body )
684
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
685
685
self .assertEqual (1 , len (channel .json_body ["results" ]))
686
686
self .assertEqual ("complete" , channel .json_body ["results" ][0 ]["status" ])
687
687
self .assertEqual (purge_id2 , channel .json_body ["results" ][0 ]["purge_id" ])
@@ -695,7 +695,7 @@ def test_delete_expired_status(self):
695
695
access_token = self .admin_user_tok ,
696
696
)
697
697
698
- self .assertEqual (404 , channel .code , msg = channel .json_body )
698
+ self .assertEqual (HTTPStatus . NOT_FOUND , channel .code , msg = channel .json_body )
699
699
self .assertEqual (Codes .NOT_FOUND , channel .json_body ["errcode" ])
700
700
701
701
def test_delete_same_room_twice (self ):
@@ -721,7 +721,7 @@ def test_delete_same_room_twice(self):
721
721
access_token = self .admin_user_tok ,
722
722
)
723
723
724
- self .assertEqual (400 , second_channel .code , msg = second_channel .json_body )
724
+ self .assertEqual (HTTPStatus . BAD_REQUEST , second_channel .code , msg = second_channel .json_body )
725
725
self .assertEqual (Codes .UNKNOWN , second_channel .json_body ["errcode" ])
726
726
self .assertEqual (
727
727
f"History purge already in progress for { self .room_id } " ,
@@ -730,7 +730,7 @@ def test_delete_same_room_twice(self):
730
730
731
731
# get result of first call
732
732
first_channel .await_result ()
733
- self .assertEqual (200 , first_channel .code , msg = first_channel .json_body )
733
+ self .assertEqual (HTTPStatus . OK , first_channel .code , msg = first_channel .json_body )
734
734
self .assertIn ("purge_id" , first_channel .json_body )
735
735
736
736
# check status after finish the task
@@ -761,7 +761,7 @@ def test_purge_room_and_block(self):
761
761
access_token = self .admin_user_tok ,
762
762
)
763
763
764
- self .assertEqual (200 , channel .code , msg = channel .json_body )
764
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
765
765
self .assertIn ("purge_id" , channel .json_body )
766
766
purge_id = channel .json_body ["purge_id" ]
767
767
@@ -792,7 +792,7 @@ def test_purge_room_and_not_block(self):
792
792
access_token = self .admin_user_tok ,
793
793
)
794
794
795
- self .assertEqual (200 , channel .code , msg = channel .json_body )
795
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
796
796
self .assertIn ("purge_id" , channel .json_body )
797
797
purge_id = channel .json_body ["purge_id" ]
798
798
@@ -824,7 +824,7 @@ def test_block_room_and_not_purge(self):
824
824
access_token = self .admin_user_tok ,
825
825
)
826
826
827
- self .assertEqual (200 , channel .code , msg = channel .json_body )
827
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
828
828
self .assertIn ("purge_id" , channel .json_body )
829
829
purge_id = channel .json_body ["purge_id" ]
830
830
@@ -870,7 +870,7 @@ def test_shutdown_room_consent(self):
870
870
access_token = self .admin_user_tok ,
871
871
)
872
872
873
- self .assertEqual (200 , channel .code , msg = channel .json_body )
873
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
874
874
self .assertIn ("purge_id" , channel .json_body )
875
875
purge_id = channel .json_body ["purge_id" ]
876
876
@@ -881,7 +881,7 @@ def test_shutdown_room_consent(self):
881
881
self .url_status_by_room_id ,
882
882
access_token = self .admin_user_tok ,
883
883
)
884
- self .assertEqual (200 , channel .code , msg = channel .json_body )
884
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
885
885
self .assertEqual (1 , len (channel .json_body ["results" ]))
886
886
887
887
# Test that member has moved to new room
@@ -908,7 +908,7 @@ def test_shutdown_room_block_peek(self):
908
908
content = {"history_visibility" : "world_readable" },
909
909
access_token = self .other_user_tok ,
910
910
)
911
- self .assertEqual (200 , channel .code , msg = channel .json_body )
911
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
912
912
913
913
# Test that room is not purged
914
914
with self .assertRaises (AssertionError ):
@@ -925,7 +925,7 @@ def test_shutdown_room_block_peek(self):
925
925
access_token = self .admin_user_tok ,
926
926
)
927
927
928
- self .assertEqual (200 , channel .code , msg = channel .json_body )
928
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
929
929
self .assertIn ("purge_id" , channel .json_body )
930
930
purge_id = channel .json_body ["purge_id" ]
931
931
@@ -936,7 +936,7 @@ def test_shutdown_room_block_peek(self):
936
936
self .url_status_by_room_id ,
937
937
access_token = self .admin_user_tok ,
938
938
)
939
- self .assertEqual (200 , channel .code , msg = channel .json_body )
939
+ self .assertEqual (HTTPStatus . OK , channel .code , msg = channel .json_body )
940
940
self .assertEqual (1 , len (channel .json_body ["results" ]))
941
941
942
942
# Test that member has moved to new room
@@ -1020,7 +1020,11 @@ def _test_result(
1020
1020
self .url_status_by_room_id ,
1021
1021
access_token = self .admin_user_tok ,
1022
1022
)
1023
- self .assertEqual (200 , channel_room_id .code , msg = channel_room_id .json_body )
1023
+ self .assertEqual (
1024
+ HTTPStatus .OK ,
1025
+ channel_room_id .code ,
1026
+ msg = channel_room_id .json_body
1027
+ )
1024
1028
self .assertEqual (1 , len (channel_room_id .json_body ["results" ]))
1025
1029
self .assertEqual (purge_id , channel_room_id .json_body ["results" ][0 ]["purge_id" ])
1026
1030
@@ -1030,7 +1034,11 @@ def _test_result(
1030
1034
self .url_status_by_purge_id + purge_id ,
1031
1035
access_token = self .admin_user_tok ,
1032
1036
)
1033
- self .assertEqual (200 , channel_purge_id .code , msg = channel_purge_id .json_body )
1037
+ self .assertEqual (
1038
+ HTTPStatus .OK ,
1039
+ channel_purge_id .code ,
1040
+ msg = channel_purge_id .json_body ,
1041
+ )
1034
1042
1035
1043
# test values that are the same in both responses
1036
1044
for content in [
0 commit comments