Skip to content

Commit 093e445

Browse files
committed
chore: apply review findings
1 parent f1f3629 commit 093e445

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

run_checks.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
# FingerprintApi->search_events usage example
2222
try:
2323
search_events_response = api_instance.search_events(2, start=start, end=end)
24+
if len(search_events_response.events) == 0:
25+
print("FingerprintApi.search_events: is empty")
26+
exit(1)
2427
first_event = search_events_response.events[0]
2528
first_event_identification_data = first_event.products.identification.data
2629
visitor_id = first_event_identification_data.visitor_id
@@ -29,11 +32,11 @@
2932
search_events_response_second_page = api_instance.search_events(2, start=start, end=end, pagination_key=search_events_response.pagination_key)
3033

3134
if len(search_events_response_second_page.events) == 0:
32-
print("Second page of FingerprintApi->search_events: is empty")
35+
print("Second page of FingerprintApi.search_events: is empty")
3336
exit(1)
3437

3538
except ApiException as e:
36-
print("Exception when calling FingerprintApi->search_events: %s\n" % e)
39+
print("Exception when calling FingerprintApi.search_events: %s\n" % e)
3740
exit(1)
3841

3942
# Use existing visitor_id from FingerprintApi->search_events response to check FingerprintApi->get_visits method
@@ -42,7 +45,7 @@
4245
print("\n\n\nVisits response: \n", visits_response)
4346

4447
except ApiException as e:
45-
print("Exception when calling FingerprintApi->get_visits: %s\n" % e)
48+
print("Exception when calling FingerprintApi.get_visits: %s\n" % e)
4649
exit(1)
4750

4851
# Use existing request_id from FingerprintApi->search_events response to check FingerprintApi->get_event method
@@ -51,7 +54,7 @@
5154
print("\n\n\nEvent response: \n", events_response.products)
5255

5356
except ApiException as e:
54-
print("Exception when calling FingerprintApi->get_event: %s\n" % e)
57+
print("Exception when calling FingerprintApi.get_event: %s\n" % e)
5558
exit(1)
5659

5760
# Async methods examples
@@ -69,10 +72,17 @@
6972
# Check that old events are still match expected format
7073
try:
7174
search_events_response_old = api_instance.search_events(1, start=start, end=end, reverse=True)
75+
if len(search_events_response_old.events) == 0:
76+
print("FingerprintApi.search_events: is empty for old events\n")
77+
exit(1)
7278
old_event_identification_data = search_events_response_old.events[0].products.identification.data
7379
visitor_id_old = old_event_identification_data.visitor_id
7480
request_id_old = old_event_identification_data.request_id
7581

82+
if visitor_id_old == visitor_id or request_id_old == request_id:
83+
print("Old events are identical to new\n")
84+
exit(1)
85+
7686
api_instance.get_visits(visitor_id_old, limit=2)
7787
api_instance.get_event(request_id_old)
7888
print("\n\n\nOld events are good\n")

0 commit comments

Comments
 (0)