Skip to content

Commit f08d15f

Browse files
committed
chore: don't use outdated events in functional tests
1 parent 98d5c89 commit f08d15f

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
PRIVATE_KEY=<SECRET_API_KEY>
2-
REQUEST_ID=<REQUEST_ID>
3-
VISITOR_ID=<VISITOR_ID>
42
VISITOR_ID_TO_DELETE=<VISITOR_ID_TO_DELETE> # for delete visitor example
53
REQUEST_ID_TO_UPDATE=<REQUEST_ID_TO_UPDATE> # for update event example
64
# put 'eu' or 'ap' if necessary, 'us' is default

run_checks.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,41 @@
1212

1313
# create an instance of the API class
1414
api_instance = fingerprint_pro_server_api_sdk.FingerprintApi(configuration)
15-
visitor_id = os.environ["VISITOR_ID"]
16-
request_id = os.environ["REQUEST_ID"]
1715

16+
# FingerprintApi->search_events usage example
1817
try:
19-
visits_response = api_instance.get_visits(visitor_id, limit=2)
20-
pagination_key = visits_response.pagination_key
21-
print("\n\n\nVisits response: \n", visits_response)
18+
search_events_response = api_instance.search_events(2)
19+
first_event = search_events_response.events[0]
20+
first_event_identification_data = first_event.products.identification.data
21+
visitor_id = first_event_identification_data.visitor_id
22+
request_id = first_event_identification_data.request_id
23+
print("\n\n\nSearch events response: \n", search_events_response)
24+
search_events_response_second_page = api_instance.search_events(2, pagination_key=search_events_response.pagination_key)
2225

23-
visits_response = api_instance.get_visits(
24-
visitor_id, limit=2, pagination_key=pagination_key)
26+
if len(search_events_response_second_page.events) == 0:
27+
print("Second page of FingerprintApi->search_events: is empty")
28+
exit(1)
2529

2630
except ApiException as e:
27-
print("Exception when calling DefaultApi->visitors_visitor_id_get: %s\n" % e)
31+
print("Exception when calling FingerprintApi->search_events: %s\n" % e)
2832
exit(1)
2933

34+
# Use existing visitor_id from FingerprintApi->search_events response to check FingerprintApi->get_visits method
3035
try:
31-
events_response = api_instance.get_event(request_id)
32-
print("\n\n\nEvent response: \n", events_response.products)
36+
visits_response = api_instance.get_visits(visitor_id, limit=2)
37+
print("\n\n\nVisits response: \n", visits_response)
3338

3439
except ApiException as e:
35-
print("Exception when calling DefaultApi->get_event: %s\n" % e)
40+
print("Exception when calling FingerprintApi->get_visits: %s\n" % e)
3641
exit(1)
3742

43+
# Use existing request_id from FingerprintApi->search_events response to check FingerprintApi->get_event method
3844
try:
39-
search_events_response = api_instance.search_events(2, bot="bad")
40-
print("\n\n\nSearch events response: \n", search_events_response)
45+
events_response = api_instance.get_event(request_id)
46+
print("\n\n\nEvent response: \n", events_response.products)
4147

4248
except ApiException as e:
43-
print("Exception when calling DefaultApi->search_events: %s\n" % e)
49+
print("Exception when calling FingerprintApi->get_event: %s\n" % e)
4450
exit(1)
4551

4652
# Async methods examples

0 commit comments

Comments
 (0)