Skip to content

Commit 89dd114

Browse files
committed
more test cleanups
1 parent 928369b commit 89dd114

1 file changed

Lines changed: 10 additions & 59 deletions

File tree

‎tests/integrations/strawberry/test_strawberry.py‎

Lines changed: 10 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def test_replace_existing_sentry_sync_extension(sentry_init):
172172

173173

174174
@parameterize_strawberry_test
175-
def test_do_not_capture_request_if_send_pii_is_off(
175+
def test_do_not_capture_request_if_data_collection_settings_are_off(
176176
request,
177177
sentry_init,
178178
capture_events,
@@ -475,10 +475,6 @@ def test_breadcrumb_no_operation_name(
475475

476476

477477
@parameterize_strawberry_test
478-
@pytest.mark.parametrize(
479-
"send_default_pii",
480-
[True, False],
481-
)
482478
def test_capture_segment_on_error(
483479
request,
484480
sentry_init,
@@ -487,10 +483,9 @@ def test_capture_segment_on_error(
487483
client_factory,
488484
async_execution,
489485
framework_integrations,
490-
send_default_pii,
491486
):
492487
sentry_init(
493-
send_default_pii=send_default_pii,
488+
data_collection={},
494489
integrations=[
495490
StrawberryIntegration(async_execution=async_execution),
496491
]
@@ -526,10 +521,7 @@ def test_capture_segment_on_error(
526521
assert query_span["attributes"]["graphql.operation.type"] == "query"
527522
assert query_span["attributes"]["graphql.operation.name"] == "ErrorQuery"
528523

529-
if send_default_pii is True:
530-
assert query_span["attributes"]["graphql.document"] == query
531-
else:
532-
assert "graphql.document" not in query_span["attributes"]
524+
assert query_span["attributes"]["graphql.document"] == query
533525

534526
assert parse_span["attributes"]["sentry.op"] == OP.GRAPHQL_PARSE
535527
assert parse_span["name"] == "parsing"
@@ -545,10 +537,6 @@ def test_capture_segment_on_error(
545537

546538

547539
@parameterize_strawberry_test
548-
@pytest.mark.parametrize(
549-
"send_default_pii",
550-
[True, False],
551-
)
552540
def test_capture_segment_on_success(
553541
request,
554542
sentry_init,
@@ -557,15 +545,14 @@ def test_capture_segment_on_success(
557545
client_factory,
558546
async_execution,
559547
framework_integrations,
560-
send_default_pii,
561548
):
562549
sentry_init(
563550
integrations=[
564551
StrawberryIntegration(async_execution=async_execution),
565552
]
566553
+ framework_integrations,
567554
traces_sample_rate=1,
568-
send_default_pii=send_default_pii,
555+
data_collection={},
569556
)
570557

571558
items = capture_items("span")
@@ -593,10 +580,7 @@ def test_capture_segment_on_success(
593580
assert query_span["attributes"]["graphql.operation.type"] == "query"
594581
assert query_span["attributes"]["graphql.operation.name"] == "GreetingQuery"
595582

596-
if send_default_pii is True:
597-
assert query_span["attributes"]["graphql.document"] == query
598-
else:
599-
assert "graphql.document" not in query_span["attributes"]
583+
assert query_span["attributes"]["graphql.document"] == query
600584

601585
assert parse_span["attributes"]["sentry.op"] == OP.GRAPHQL_PARSE
602586
assert parse_span["name"] == "parsing"
@@ -612,10 +596,6 @@ def test_capture_segment_on_success(
612596

613597

614598
@parameterize_strawberry_test
615-
@pytest.mark.parametrize(
616-
"send_default_pii",
617-
[True, False],
618-
)
619599
def test_segment_no_operation_name(
620600
request,
621601
sentry_init,
@@ -624,15 +604,14 @@ def test_segment_no_operation_name(
624604
client_factory,
625605
async_execution,
626606
framework_integrations,
627-
send_default_pii,
628607
):
629608
sentry_init(
630609
integrations=[
631610
StrawberryIntegration(async_execution=async_execution),
632611
]
633612
+ framework_integrations,
634613
traces_sample_rate=1,
635-
send_default_pii=send_default_pii,
614+
data_collection={},
636615
)
637616

638617
items = capture_items("span")
@@ -659,10 +638,7 @@ def test_segment_no_operation_name(
659638
assert query_span["attributes"]["graphql.operation.type"] == "query"
660639
assert "graphql.operation.name" not in query_span["attributes"]
661640

662-
if send_default_pii is True:
663-
assert query_span["attributes"]["graphql.document"] == query
664-
else:
665-
assert "graphql.document" not in query_span["attributes"]
641+
assert query_span["attributes"]["graphql.document"] == query
666642

667643
assert parse_span["attributes"]["sentry.op"] == OP.GRAPHQL_PARSE
668644
assert parse_span["name"] == "parsing"
@@ -678,10 +654,6 @@ def test_segment_no_operation_name(
678654

679655

680656
@parameterize_strawberry_test
681-
@pytest.mark.parametrize(
682-
"send_default_pii",
683-
[True, False],
684-
)
685657
def test_segment_mutation(
686658
request,
687659
sentry_init,
@@ -690,15 +662,14 @@ def test_segment_mutation(
690662
client_factory,
691663
async_execution,
692664
framework_integrations,
693-
send_default_pii,
694665
):
695666
sentry_init(
696667
integrations=[
697668
StrawberryIntegration(async_execution=async_execution),
698669
]
699670
+ framework_integrations,
700671
traces_sample_rate=1,
701-
send_default_pii=send_default_pii,
672+
data_collection={},
702673
)
703674

704675
items = capture_items("span")
@@ -726,10 +697,7 @@ def test_segment_mutation(
726697
assert mutation_span["attributes"]["graphql.operation.type"] == "mutation"
727698
assert "graphql.operation.name" not in mutation_span["attributes"]
728699

729-
if send_default_pii is True:
730-
assert mutation_span["attributes"]["graphql.document"] == query
731-
else:
732-
assert "graphql.document" not in mutation_span["attributes"]
700+
assert mutation_span["attributes"]["graphql.document"] == query
733701

734702
assert parse_span["attributes"]["sentry.op"] == OP.GRAPHQL_PARSE
735703
assert parse_span["name"] == "parsing"
@@ -746,32 +714,18 @@ def test_segment_mutation(
746714

747715
@parameterize_strawberry_test
748716
@pytest.mark.parametrize(
749-
"data_collection,send_default_pii,expect_document",
717+
"data_collection,expect_document",
750718
[
751719
pytest.param(
752720
{"graphql": {"document": True}},
753-
None,
754721
True,
755722
id="document_on_sets_graphql_document",
756723
),
757724
pytest.param(
758725
{"graphql": {"document": False}},
759-
None,
760726
False,
761727
id="document_off_omits_graphql_document",
762728
),
763-
pytest.param(
764-
{"graphql": {"document": False}},
765-
True,
766-
False,
767-
id="data_collection_takes_precedence_over_send_default_pii_on",
768-
),
769-
pytest.param(
770-
{"graphql": {"document": True}},
771-
False,
772-
True,
773-
id="data_collection_takes_precedence_over_send_default_pii_off",
774-
),
775729
],
776730
)
777731
def test_graphql_span_data_collection(
@@ -783,7 +737,6 @@ def test_graphql_span_data_collection(
783737
async_execution,
784738
framework_integrations,
785739
data_collection,
786-
send_default_pii,
787740
expect_document,
788741
):
789742
init_kwargs = {
@@ -792,8 +745,6 @@ def test_graphql_span_data_collection(
792745
"traces_sample_rate": 1,
793746
"data_collection": data_collection,
794747
}
795-
if send_default_pii is not None:
796-
init_kwargs["send_default_pii"] = send_default_pii
797748

798749
sentry_init(**init_kwargs)
799750

0 commit comments

Comments
 (0)