@@ -103,7 +103,7 @@ def request(self, *args, **kwargs):
103
103
104
104
self ._tc .maxDiff = None
105
105
self ._tc .assertEqual (r [0 ], args )
106
- self ._tc .assertEqual (r [1 ], kwargs )
106
+ self ._tc .assertCountEqual (r [1 ], kwargs )
107
107
108
108
# TODO Add support for more complex paths?
109
109
mock_file_by_first_argument = MockPoolManager .get_mock_from_path (request_path )
@@ -696,52 +696,47 @@ def test_search_events_only_limit(self):
696
696
697
697
def test_search_events_all_params (self ):
698
698
"""Test that search events returns 200 with all params"""
699
- LIMIT = 100
700
- BOT = 'good'
701
- IP_ADDRESS = '10.0.0.0/24'
702
- LINKED_ID = 'some_linked_id'
703
- START = 1582299576511
704
- END = 1582299576513
705
- REVERSE = True
706
- SUSPECT = False
707
- ANTI_DETECT_BROWSER = True
708
- CLONED_APP = True
709
- FACTORY_RESET = True
710
- FRIDA = True
711
- JAILBROKEN = True
712
- MIN_SUSPECT_SCORE = .5
713
- PRIVACY_SETTINGS = True
714
- ROOT_APPS = True
715
- TAMPERING = True
716
- VIRTUAL_MACHINE = True
717
- VPN = True
718
- VPN_CONFIDENCE = 'medium'
719
- EMULATOR = True
720
- INCOGNITO = True
699
+ params = {
700
+ 'limit' : 100 ,
701
+ 'visitor_id' : MOCK_SEARCH_EVENTS_200 ,
702
+ 'bot' : 'good' ,
703
+ 'ip_address' : '10.0.0.0/24' ,
704
+ 'linked_id' : 'some_linked_id' ,
705
+ 'start' : 1582299576511 ,
706
+ 'end' : 1582299576513 ,
707
+ 'reverse' : True ,
708
+ 'suspect' : False ,
709
+ 'anti_detect_browser' : True ,
710
+ 'cloned_app' : True ,
711
+ 'factory_reset' : True ,
712
+ 'frida' : True ,
713
+ 'jailbroken' : True ,
714
+ 'min_suspect_score' : .5 ,
715
+ 'privacy_settings' : True ,
716
+ 'root_apps' : True ,
717
+ 'tampering' : True ,
718
+ 'virtual_machine' : True ,
719
+ 'vpn' : True ,
720
+ 'vpn_confidence' : 'medium' ,
721
+ 'emulator' : True ,
722
+ 'incognito' : True ,
723
+ }
724
+
725
+ expected_fields = [self .integration_info ] + list (params .items ())
721
726
722
727
mock_pool = MockPoolManager (self )
723
728
self .api .api_client .rest_client .pool_manager = mock_pool
724
- mock_pool .expect_request ('GET' , TestFingerprintApi .get_search_events_path (),
725
- fields = [self .integration_info , ('limit' , LIMIT ),
726
- ('visitor_id' , MOCK_SEARCH_EVENTS_200 ), ('bot' , BOT ),
727
- ('ip_address' , IP_ADDRESS ), ('linked_id' , LINKED_ID ), ('start' , START ),
728
- ('end' , END ), ('reverse' , REVERSE ), ('suspect' , SUSPECT ), ('vpn' , VPN ),
729
- ('virtual_machine' , VIRTUAL_MACHINE ), ('tampering' , TAMPERING ),
730
- ('anti_detect_browser' , ANTI_DETECT_BROWSER ), ('incognito' , INCOGNITO ),
731
- ('privacy_settings' , PRIVACY_SETTINGS ), ('jailbroken' , JAILBROKEN ),
732
- ('frida' , FRIDA ), ('factory_reset' , FACTORY_RESET ), ('cloned_app' , CLONED_APP ),
733
- ('emulator' , EMULATOR ), ('root_apps' , ROOT_APPS ),
734
- ('vpn_confidence' , VPN_CONFIDENCE ), ('min_suspect_score' , MIN_SUSPECT_SCORE )],
735
- headers = self .request_headers , preload_content = True , timeout = None )
729
+ mock_pool .expect_request (
730
+ 'GET' ,
731
+ TestFingerprintApi .get_search_events_path (),
732
+ fields = expected_fields ,
733
+ headers = self .request_headers ,
734
+ preload_content = True ,
735
+ timeout = None
736
+ )
737
+
738
+ response = self .api .search_events (** params )
736
739
737
- response = self .api .search_events (LIMIT , visitor_id = MOCK_SEARCH_EVENTS_200 , bot = BOT , ip_address = IP_ADDRESS ,
738
- linked_id = LINKED_ID , start = START , end = END , reverse = REVERSE , suspect = SUSPECT ,
739
- anti_detect_browser = ANTI_DETECT_BROWSER , cloned_app = CLONED_APP ,
740
- factory_reset = FACTORY_RESET , frida = FRIDA , jailbroken = JAILBROKEN ,
741
- min_suspect_score = MIN_SUSPECT_SCORE , privacy_settings = PRIVACY_SETTINGS ,
742
- root_apps = ROOT_APPS , tampering = TAMPERING , virtual_machine = VIRTUAL_MACHINE ,
743
- vpn = VPN , vpn_confidence = VPN_CONFIDENCE , emulator = EMULATOR ,
744
- incognito = INCOGNITO )
745
740
self .assertIsInstance (response , SearchEventsResponse )
746
741
event_response = response .events [0 ]
747
742
self .assertIsInstance (event_response , SearchEventsResponseEvents )
0 commit comments