Skip to content

Commit 2ec10c6

Browse files
committed
test: assert event timeout directly in EventAPIClientTest
1 parent ce6fb9a commit 2ec10c6

2 files changed

Lines changed: 18 additions & 47 deletions

File tree

‎test/api/test_event_client.py‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ def test_publish_events_empty_batch(self):
6666
message = self.test_client.publish_events([])
6767
self.assertEqual(message, "Successfully received 1 event batches.")
6868

69+
@responses.activate
70+
def test_publish_events_timeout_in_seconds(self):
71+
responses.add(responses.POST, self.test_batch_url, json={"message": "ok"})
72+
self.test_client.publish_events(self.test_batch)
73+
self.assertEqual(responses.calls[0].request.req_kwargs["timeout"], 10.0)
74+
75+
@responses.activate
76+
def test_publish_events_custom_timeout_in_seconds(self):
77+
client = EventAPIClient(
78+
self.sdk_key,
79+
DevCycleLocalOptions(
80+
events_api_uri="http://localhost:8080", event_request_timeout_ms=250
81+
),
82+
)
83+
responses.add(responses.POST, self.test_batch_url, json={"message": "ok"})
84+
client.publish_events(self.test_batch)
85+
self.assertEqual(responses.calls[0].request.req_kwargs["timeout"], 0.25)
86+
6987
@responses.activate(registry=OrderedRegistry)
7088
def test_publish_events_retries_exceeded(self):
7189
for i in range(2):

‎test/api/test_event_timeout.py‎

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)