forked from getsentry/sentry-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_requests.py
More file actions
25 lines (19 loc) · 727 Bytes
/
Copy pathtest_requests.py
File metadata and controls
25 lines (19 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest
requests = pytest.importorskip("requests")
from sentry_sdk import capture_message
from sentry_sdk.integrations.stdlib import StdlibIntegration
def test_crumb_capture(sentry_init, capture_events):
sentry_init(integrations=[StdlibIntegration()])
events = capture_events()
response = requests.get("https://httpbin.org/status/418")
capture_message("Testing!")
(event,) = events
(crumb,) = event["breadcrumbs"]["values"]
assert crumb["type"] == "http"
assert crumb["category"] == "httplib"
assert crumb["data"] == {
"url": "https://httpbin.org/status/418",
"method": "GET",
"status_code": response.status_code,
"reason": response.reason,
}