@@ -584,7 +584,9 @@ def test_get_replays_user_filters(self):
584
584
self .mock_event_links (seq1_timestamp , project .id , "debug" , replay1_id , uuid .uuid4 ().hex )
585
585
)
586
586
self .store_replays (
587
- mock_replay_viewed (seq1_timestamp .timestamp (), project .id , replay1_id , viewed_by_id = 1 )
587
+ mock_replay_viewed (
588
+ seq1_timestamp .timestamp (), project .id , replay1_id , viewed_by_id = self .user .id
589
+ )
588
590
)
589
591
590
592
with self .feature (self .features ):
@@ -610,8 +612,6 @@ def test_get_replays_user_filters(self):
610
612
"duration:<18s" ,
611
613
"duration:>=17s" ,
612
614
"duration:<=17s" ,
613
- # "duration:[16s,17s]", # TODO: need to add duration_in_filters in event_search.py
614
- # "!duration:[16s,18s]",
615
615
"duration:17000ms" , # If duration value is not equal to a whole number of seconds, the endpoint fails.
616
616
"duration:<1m" ,
617
617
"duration:<1min" ,
@@ -682,12 +682,14 @@ def test_get_replays_user_filters(self):
682
682
"count_infos:2" ,
683
683
"count_infos:>1" ,
684
684
"count_infos:<3" ,
685
- "viewed_by_id:1" ,
686
- "!viewed_by_id:2" ,
687
- "viewed_by_id:[1,2]" ,
688
- "seen_by_id:1" ,
689
- "!seen_by_id:2" ,
690
- "seen_by_id:[1,2]" ,
685
+ f"viewed_by_id:{ self .user .id } " ,
686
+ f"!viewed_by_id:{ self .user .id + 1 } " ,
687
+ f"viewed_by_id:[{ self .user .id + 3 } ,{ self .user .id } ]" ,
688
+ f"seen_by_id:{ self .user .id } " ,
689
+ f"!seen_by_id:{ self .user .id + 1 } " ,
690
+ f"seen_by_id:[{ self .user .id + 3 } ,{ self .user .id } ]" ,
691
+ "viewed_by_me:true" ,
692
+ "seen_by_me:true" ,
691
693
]
692
694
693
695
for query in queries :
@@ -736,8 +738,10 @@ def test_get_replays_user_filters(self):
736
738
"!c:*st" ,
737
739
"!activity:8" ,
738
740
"activity:<2" ,
739
- "viewed_by_id:2" ,
740
- "seen_by_id:2" ,
741
+ f"viewed_by_id:{ self .user .id + 1 } " ,
742
+ f"seen_by_id:{ self .user .id + 1 } " ,
743
+ "viewed_by_me:false" ,
744
+ "seen_by_me:false" ,
741
745
742
746
743
747
]
@@ -938,7 +942,7 @@ def test_get_replays_filter_bad_operator(self):
938
942
with self .feature (self .features ):
939
943
for query in queries :
940
944
response = self .client .get (self .url + f"?field=id&query={ query } " )
941
- assert response .status_code == 400
945
+ assert response .status_code == 400 , query
942
946
943
947
def test_get_replays_filter_bad_value (self ):
944
948
"""Test replays conform to the interchange format."""
@@ -956,20 +960,28 @@ def test_get_replays_filter_bad_value(self):
956
960
with self .feature (self .features ):
957
961
for query in queries :
958
962
response = self .client .get (self .url + f"?query={ query } " )
959
- assert response .status_code == 400
960
- field = query .split (":" )[0 ]
961
- assert field .encode () in response .content
963
+ assert response .status_code == 400 , query
962
964
963
- # No such thing as a bad field with the tag filtering behavior.
964
- #
965
- # def test_get_replays_filter_bad_field(self):
966
- # """Test replays conform to the interchange format."""
967
- # self.create_project(teams=[self.team])
965
+ def test_get_replays_filter_bad_duration_error_messages (self ):
966
+ # TODO: remove once we support ms timestamps
967
+ self .create_project (teams = [self .team ])
968
+ queries = [
969
+ "duration:1004ms" ,
970
+ "duration:7.3s" ,
971
+ "duration:1.33min" ,
972
+ ]
968
973
969
- # with self.feature(self.features):
970
- # response = self.client.get(self.url + "?query=xyz:a")
971
- # assert response.status_code == 400
972
- # assert b"xyz" in response.content
974
+ with self .feature (self .features ):
975
+ for query in queries :
976
+ response = self .client .get (self .url + f"?query={ query } " )
977
+ assert response .status_code == 400 , query
978
+ assert (
979
+ b"Replays only supports second-resolution timestamps at this time"
980
+ in response .content
981
+ ), query
982
+ assert b"duration" in response .content , query
983
+
984
+ # Note: there's no such thing as a bad field with the tag filtering behavior.
973
985
974
986
def test_get_replays_unknown_field (self ):
975
987
"""Test replays unknown fields raise a 400 error."""
0 commit comments