|
14 | 14 | from werkzeug.test import Client |
15 | 15 |
|
16 | 16 | from sentry_sdk import start_transaction |
17 | | -from sentry_sdk.consts import SPANDATA, DBOPERATION |
| 17 | +from sentry_sdk.consts import SPANDATA, SPANNAME |
18 | 18 | from sentry_sdk.integrations.django import DjangoIntegration |
19 | 19 |
|
20 | 20 | from tests.integrations.django.utils import pytest_mark_django_db_decorator |
@@ -145,8 +145,8 @@ def test_db_transaction_spans_disabled_no_autocommit( |
145 | 145 | sqlite_rollback["spans"], |
146 | 146 | sqlite_commit["spans"], |
147 | 147 | ) |
148 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.COMMIT |
149 | | - or span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 148 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.COMMIT |
| 149 | + or span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
150 | 150 | ] |
151 | 151 | assert len(commit_spans) == 0 |
152 | 152 |
|
@@ -263,8 +263,8 @@ def test_db_transaction_spans_disabled_atomic(sentry_init, client, capture_event |
263 | 263 | sqlite_rollback["spans"], |
264 | 264 | sqlite_commit["spans"], |
265 | 265 | ) |
266 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.COMMIT |
267 | | - or span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 266 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.COMMIT |
| 267 | + or span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
268 | 268 | ] |
269 | 269 | assert len(commit_spans) == 0 |
270 | 270 |
|
@@ -297,7 +297,7 @@ def test_db_no_autocommit_execute(sentry_init, client, capture_events): |
297 | 297 | commit_spans = [ |
298 | 298 | span |
299 | 299 | for span in event["spans"] |
300 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.COMMIT |
| 300 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.COMMIT |
301 | 301 | ] |
302 | 302 | assert len(commit_spans) == 1 |
303 | 303 | commit_span = commit_spans[0] |
@@ -388,7 +388,7 @@ def test_db_no_autocommit_executemany(sentry_init, client, capture_events): |
388 | 388 | commit_spans = [ |
389 | 389 | span |
390 | 390 | for span in event["spans"] |
391 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.COMMIT |
| 391 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.COMMIT |
392 | 392 | ] |
393 | 393 | assert len(commit_spans) == 1 |
394 | 394 | commit_span = commit_spans[0] |
@@ -439,7 +439,7 @@ def test_db_no_autocommit_rollback_execute(sentry_init, client, capture_events): |
439 | 439 | rollback_spans = [ |
440 | 440 | span |
441 | 441 | for span in event["spans"] |
442 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 442 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
443 | 443 | ] |
444 | 444 | assert len(rollback_spans) == 1 |
445 | 445 | rollback_span = rollback_spans[0] |
@@ -530,7 +530,7 @@ def test_db_no_autocommit_rollback_executemany(sentry_init, client, capture_even |
530 | 530 | rollback_spans = [ |
531 | 531 | span |
532 | 532 | for span in event["spans"] |
533 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 533 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
534 | 534 | ] |
535 | 535 | assert len(rollback_spans) == 1 |
536 | 536 | rollback_span = rollback_spans[0] |
@@ -581,7 +581,7 @@ def test_db_atomic_execute(sentry_init, client, capture_events): |
581 | 581 | commit_spans = [ |
582 | 582 | span |
583 | 583 | for span in event["spans"] |
584 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.COMMIT |
| 584 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.COMMIT |
585 | 585 | ] |
586 | 586 | assert len(commit_spans) == 1 |
587 | 587 | commit_span = commit_spans[0] |
@@ -669,7 +669,7 @@ def test_db_atomic_executemany(sentry_init, client, capture_events): |
669 | 669 | commit_spans = [ |
670 | 670 | span |
671 | 671 | for span in event["spans"] |
672 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.COMMIT |
| 672 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.COMMIT |
673 | 673 | ] |
674 | 674 | assert len(commit_spans) == 1 |
675 | 675 | commit_span = commit_spans[0] |
@@ -721,7 +721,7 @@ def test_db_atomic_rollback_execute(sentry_init, client, capture_events): |
721 | 721 | rollback_spans = [ |
722 | 722 | span |
723 | 723 | for span in event["spans"] |
724 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 724 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
725 | 725 | ] |
726 | 726 | assert len(rollback_spans) == 1 |
727 | 727 | rollback_span = rollback_spans[0] |
@@ -810,7 +810,7 @@ def test_db_atomic_rollback_executemany(sentry_init, client, capture_events): |
810 | 810 | rollback_spans = [ |
811 | 811 | span |
812 | 812 | for span in event["spans"] |
813 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 813 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
814 | 814 | ] |
815 | 815 | assert len(rollback_spans) == 1 |
816 | 816 | rollback_span = rollback_spans[0] |
@@ -862,7 +862,7 @@ def test_db_atomic_execute_exception(sentry_init, client, capture_events): |
862 | 862 | rollback_spans = [ |
863 | 863 | span |
864 | 864 | for span in event["spans"] |
865 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 865 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
866 | 866 | ] |
867 | 867 | assert len(rollback_spans) == 1 |
868 | 868 | rollback_span = rollback_spans[0] |
@@ -954,7 +954,7 @@ def test_db_atomic_executemany_exception(sentry_init, client, capture_events): |
954 | 954 | rollback_spans = [ |
955 | 955 | span |
956 | 956 | for span in event["spans"] |
957 | | - if span["data"].get(SPANDATA.DB_OPERATION) == DBOPERATION.ROLLBACK |
| 957 | + if span["data"].get(SPANDATA.DB_OPERATION) == SPANNAME.ROLLBACK |
958 | 958 | ] |
959 | 959 | assert len(rollback_spans) == 1 |
960 | 960 | rollback_span = rollback_spans[0] |
|
0 commit comments