|
8 | 8 | from securenative.enums.event_types import EventTypes |
9 | 9 | from securenative.enums.risk_level import RiskLevel |
10 | 10 | from securenative.event_manager import EventManager |
11 | | -from securenative.exceptions.securenative_invalid_options_exception import SecureNativeInvalidOptionsException |
12 | 11 | from securenative.models.event_options import EventOptions |
13 | 12 | from securenative.models.user_traits import UserTraits |
14 | 13 | from securenative.models.verify_result import VerifyResult |
@@ -49,6 +48,25 @@ def test_track_event(self): |
49 | 48 | finally: |
50 | 49 | event_manager.stop_event_persist() |
51 | 50 |
|
| 51 | + @responses.activate |
| 52 | + def test_should_timeout_on_post(self): |
| 53 | + options = SecureNativeOptions(api_key="YOUR_API_KEY", auto_send=True, timeout=-1, |
| 54 | + api_url="https://api.securenative-stg.com/collector/api/v1") |
| 55 | + |
| 56 | + responses.add(responses.POST, "https://api.securenative-stg.com/collector/api/v1/verify", |
| 57 | + json={"event": "SOME_EVENT_NAME"}, status=408) |
| 58 | + |
| 59 | + event_manager = EventManager(options) |
| 60 | + event_manager.start_event_persist() |
| 61 | + api_manager = ApiManager(event_manager, options) |
| 62 | + |
| 63 | + verify_result = VerifyResult(RiskLevel.LOW.value, 0, None) |
| 64 | + res = api_manager.verify(self.event_options) |
| 65 | + |
| 66 | + self.assertEqual(res.risk_level, verify_result.risk_level) |
| 67 | + self.assertEqual(res.score, verify_result.score) |
| 68 | + self.assertEqual(res.triggers, verify_result.triggers) |
| 69 | + |
52 | 70 | @responses.activate |
53 | 71 | def test_verify_event(self): |
54 | 72 | options = SecureNativeOptions(api_key="YOUR_API_KEY", |
|
0 commit comments