Skip to content
Merged
Show file tree
Hide file tree
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
41 changes: 0 additions & 41 deletions tests/integrations/aiomysql/test_aiomysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,47 +361,6 @@ async def test_execute_record_params(sentry_init, capture_events) -> None:
]


@pytest.mark.asyncio
async def test_execute_record_params_with_data_collection_default(
sentry_init, capture_events
) -> None:
sentry_init(
integrations=[AioMySQLIntegration()],
data_collection={},
)
events = capture_events()

conn = await aiomysql.connect(**_connect_args())

async with conn.cursor() as cur:
await cur.execute(
"INSERT INTO users(name, password, dob) VALUES (%s, %s, %s)",
("Bob", "secret_pw", datetime.date(1984, 3, 1)),
)

conn.close()

capture_message("hi")

(event,) = events

for crumb in event["breadcrumbs"]["values"]:
del crumb["timestamp"]

assert event["breadcrumbs"]["values"] == [
CRUMBS_CONNECT,
{
"category": "query",
"data": {
"db.params": ["Bob", "secret_pw", "datetime.date(1984, 3, 1)"],
"db.paramstyle": "format",
},
"message": "INSERT INTO users(name, password, dob) VALUES (%s, %s, %s)",
"type": "default",
},
]


@pytest.mark.asyncio
async def test_cursor_context_manager(sentry_init, capture_events) -> None:
sentry_init(
Expand Down
108 changes: 2 additions & 106 deletions tests/integrations/clickhouse_driver/test_clickhouse_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,109 +322,7 @@ def test_clickhouse_client_breadcrumbs_with_data_collection_disabled(
assert event["breadcrumbs"]["values"] == expected_breadcrumbs


def test_clickhouse_client_breadcrumbs_with_data_collection_default(
sentry_init, capture_events
) -> None:
sentry_init(
integrations=[ClickhouseDriverIntegration()],
data_collection={},
)
events = capture_events()

client = Client("localhost")
client.execute("DROP TABLE IF EXISTS test")
client.execute("CREATE TABLE test (x Int32) ENGINE = Memory")
client.execute("INSERT INTO test (x) VALUES", [{"x": 100}])
client.execute("INSERT INTO test (x) VALUES", [[170], [200]])

res = client.execute("SELECT sum(x) FROM test WHERE x > %(minv)i", {"minv": 150})
assert res[0][0] == 370

capture_message("hi")

(event,) = events

expected_breadcrumbs = [
{
"category": "query",
"data": {
"db.system": "clickhouse",
"db.driver.name": "clickhouse-driver",
"db.name": "",
"db.user": "default",
"server.address": "localhost",
"server.port": 9000,
"db.result": [],
},
"message": "DROP TABLE IF EXISTS test",
"type": "default",
},
{
"category": "query",
"data": {
"db.system": "clickhouse",
"db.driver.name": "clickhouse-driver",
"db.name": "",
"db.user": "default",
"server.address": "localhost",
"server.port": 9000,
"db.result": [],
},
"message": "CREATE TABLE test (x Int32) ENGINE = Memory",
"type": "default",
},
{
"category": "query",
"data": {
"db.system": "clickhouse",
"db.driver.name": "clickhouse-driver",
"db.name": "",
"db.user": "default",
"server.address": "localhost",
"server.port": 9000,
},
"message": "INSERT INTO test (x) VALUES",
"type": "default",
},
{
"category": "query",
"data": {
"db.system": "clickhouse",
"db.driver.name": "clickhouse-driver",
"db.name": "",
"db.user": "default",
"server.address": "localhost",
"server.port": 9000,
},
"message": "INSERT INTO test (x) VALUES",
"type": "default",
},
{
"category": "query",
"data": {
"db.system": "clickhouse",
"db.driver.name": "clickhouse-driver",
"db.name": "",
"db.user": "default",
"server.address": "localhost",
"server.port": 9000,
"db.result": [[370]],
},
"message": "SELECT sum(x) FROM test WHERE x > 150",
"type": "default",
},
]

for crumb in expected_breadcrumbs:
crumb["data"] = ApproxDict(crumb["data"])

for crumb in event["breadcrumbs"]["values"]:
crumb.pop("timestamp", None)

assert event["breadcrumbs"]["values"] == expected_breadcrumbs


def test_clickhouse_client_with_data_collection(sentry_init, capture_items) -> None:
def test_clickhouse_client(sentry_init, capture_items) -> None:
sentry_init(
integrations=[ClickhouseDriverIntegration()],
traces_sample_rate=1.0,
Expand Down Expand Up @@ -455,9 +353,7 @@ def test_clickhouse_client_with_data_collection(sentry_init, capture_items) -> N
assert "db.result" not in attribute_keys


def test_clickhouse_client_send_data_generator_with_data_collection(
sentry_init, capture_events
) -> None:
def test_clickhouse_client_send_data_generator(sentry_init, capture_events) -> None:
sentry_init(
integrations=[ClickhouseDriverIntegration()],
data_collection={"database_query_data": True},
Expand Down
8 changes: 3 additions & 5 deletions tests/integrations/django/asgi/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async def test_basic(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)

import channels # type: ignore[import-not-found]
Expand Down Expand Up @@ -112,7 +111,6 @@ async def test_async_views(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)

comm = HttpCommunicator(application, "GET", "/async_message")
Expand Down Expand Up @@ -171,7 +169,6 @@ async def test_async_views_concurrent_execution(
settings.MIDDLEWARE = []
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)

application = make_asgi_application()
Expand Down Expand Up @@ -211,7 +208,6 @@ async def test_async_middleware_that_is_function_concurrent_execution(
]
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)

application = make_asgi_application()
Expand Down Expand Up @@ -507,7 +503,9 @@ async def test_asgi_request_body(
body,
expected_data,
):
sentry_init(integrations=[DjangoIntegration()], data_collection={})
sentry_init(
integrations=[DjangoIntegration()],
)

comm = HttpCommunicator(
application,
Expand Down
18 changes: 6 additions & 12 deletions tests/integrations/django/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def test_view_exceptions(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
exceptions = capture_exceptions()
items = capture_items("event")
Expand Down Expand Up @@ -85,7 +84,6 @@ def test_ensures_x_forwarded_header_is_honored_in_sdk_when_enabled_in_django(

sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
exceptions = capture_exceptions()
items = capture_items("event")
Expand All @@ -111,7 +109,6 @@ def test_ensures_x_forwarded_header_is_not_honored_when_unenabled_in_django(
"""
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
exceptions = capture_exceptions()
items = capture_items("event")
Expand All @@ -125,7 +122,9 @@ def test_ensures_x_forwarded_header_is_not_honored_when_unenabled_in_django(


def test_middleware_exceptions(sentry_init, client, capture_exceptions):
sentry_init(integrations=[DjangoIntegration()], data_collection={})
sentry_init(
integrations=[DjangoIntegration()],
)
exceptions = capture_exceptions()
client.get(reverse("middleware_exc"))

Expand All @@ -140,7 +139,6 @@ def test_request_captured(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
items = capture_items("event")
content, status, headers = unpack_werkzeug_response(client.get(reverse("message")))
Expand Down Expand Up @@ -313,7 +311,6 @@ def test_user_captured(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
items = capture_items("event")
content, status, headers = unpack_werkzeug_response(client.get(reverse("mylogin")))
Expand Down Expand Up @@ -343,7 +340,6 @@ def test_materialized_user_captured(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
)

Expand Down Expand Up @@ -445,7 +441,9 @@ def test_custom_error_handler_request_context(


def test_500(sentry_init, client):
sentry_init(integrations=[DjangoIntegration()], data_collection={})
sentry_init(
integrations=[DjangoIntegration()],
)

content, status, headers = unpack_werkzeug_response(client.get("/view-exc"))
assert status.lower() == "500 internal server error"
Expand Down Expand Up @@ -686,7 +684,6 @@ def test_django_connect_trace(
"""
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
)

Expand Down Expand Up @@ -847,7 +844,6 @@ def test_segment_name(
sentry_init(
integrations=[DjangoIntegration()],
traces_sample_rate=1.0,
data_collection={},
)
items = capture_items("event", "span")

Expand Down Expand Up @@ -883,7 +879,6 @@ def test_segment_name_tracing_disabled(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
items = capture_items("event")

Expand Down Expand Up @@ -1217,7 +1212,6 @@ def test_rest_framework_basic(
pytest.importorskip("rest_framework")
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
exceptions = capture_exceptions()
items = capture_items("event")
Expand Down
1 change: 0 additions & 1 deletion tests/integrations/django/test_data_scrubbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def test_empty_query_string_is_dropped_with_data_collection(
# reduce envelope size, so the ``query_string`` key is absent.
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
)
events = capture_events()

Expand Down
6 changes: 0 additions & 6 deletions tests/integrations/django/test_db_query_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def test_query_source(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=0,
Expand Down Expand Up @@ -199,7 +198,6 @@ def test_query_source_with_module_in_search_path(

sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=0,
Expand Down Expand Up @@ -255,7 +253,6 @@ def test_query_source_with_in_app_exclude(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=0,
Expand Down Expand Up @@ -325,7 +322,6 @@ def test_query_source_with_in_app_include(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=0,
Expand Down Expand Up @@ -382,7 +378,6 @@ def test_no_query_source_if_duration_too_short(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=100,
Expand Down Expand Up @@ -451,7 +446,6 @@ def test_query_source_if_duration_over_threshold(
):
sentry_init(
integrations=[DjangoIntegration()],
data_collection={},
traces_sample_rate=1.0,
enable_db_query_source=True,
db_query_source_threshold_ms=100,
Expand Down
Loading
Loading