Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions tests/integrations/pyreqwest/test_pyreqwest.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,12 +594,10 @@ def fake_start_span(*args, **kwargs):
assert SPANDATA.CODE_FUNCTION in data


@pytest.mark.parametrize("send_default_pii", [True, False])
def test_crumb_capture(
sentry_init,
capture_events,
server_port,
send_default_pii,
):
def before_breadcrumb(crumb, hint):
crumb["data"]["extra"] = "foo"
Expand All @@ -608,7 +606,6 @@ def before_breadcrumb(crumb, hint):
sentry_init(
integrations=[PyreqwestIntegration()],
before_breadcrumb=before_breadcrumb,
send_default_pii=send_default_pii,
data_collection={},
)

Expand All @@ -633,25 +630,21 @@ def before_breadcrumb(crumb, hint):
SPANDATA.HTTP_STATUS_CODE: 200,
"extra": "foo",
}
if send_default_pii:
expected["url"] = f"http://localhost:{server_port}/hello?q=test#frag"
expected[SPANDATA.HTTP_QUERY] = "q=test"
expected[SPANDATA.HTTP_FRAGMENT] = "frag"
expected["url"] = f"http://localhost:{server_port}/hello?q=test#frag"
expected[SPANDATA.HTTP_QUERY] = "q=test"
expected[SPANDATA.HTTP_FRAGMENT] = "frag"

assert crumb["data"] == ApproxDict(expected)


@pytest.mark.asyncio
@pytest.mark.parametrize("send_default_pii", [True, False])
async def test_async_crumb_capture(
sentry_init,
capture_events,
server_port,
send_default_pii,
):
sentry_init(
integrations=[PyreqwestIntegration()],
send_default_pii=send_default_pii,
data_collection={},
)

Expand All @@ -676,10 +669,9 @@ async def test_async_crumb_capture(
SPANDATA.HTTP_METHOD: "GET",
SPANDATA.HTTP_STATUS_CODE: 200,
}
if send_default_pii:
expected["url"] = f"http://localhost:{server_port}/hello?q=test#frag"
expected[SPANDATA.HTTP_QUERY] = "q=test"
expected[SPANDATA.HTTP_FRAGMENT] = "frag"
expected["url"] = f"http://localhost:{server_port}/hello?q=test#frag"
expected[SPANDATA.HTTP_QUERY] = "q=test"
expected[SPANDATA.HTTP_FRAGMENT] = "frag"

assert crumb["data"] == ApproxDict(expected)

Expand Down
Loading