Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Jan 17, 2023
1 parent dc8595e commit e55e48e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/integrations/django/test_data_scrubbing.py
@@ -1,4 +1,6 @@
from functools import partial
import pytest
import pytest_django

from werkzeug.test import Client

Expand All @@ -12,11 +14,31 @@
from django.core.urlresolvers import reverse


# Hack to prevent from experimental feature introduced in version `4.3.0` in `pytest-django` that
# requires explicit database allow from failing the test
pytest_mark_django_db_decorator = partial(pytest.mark.django_db)
try:
pytest_version = tuple(map(int, pytest_django.__version__.split(".")))
if pytest_version > (4, 2, 0):
pytest_mark_django_db_decorator = partial(
pytest.mark.django_db, databases="__all__"
)
except ValueError:
if "dev" in pytest_django.__version__:
pytest_mark_django_db_decorator = partial(
pytest.mark.django_db, databases="__all__"
)
except AttributeError:
pass


@pytest.fixture
def client():
return Client(application)


@pytest.mark.forked
@pytest_mark_django_db_decorator()
def test_scrub_django_session_cookies_removed(
sentry_init,
client,
Expand All @@ -33,6 +55,8 @@ def test_scrub_django_session_cookies_removed(
assert "cookies" not in event["request"]


@pytest.mark.forked
@pytest_mark_django_db_decorator()
def test_scrub_django_session_cookies_filtered(
sentry_init,
client,
Expand All @@ -53,6 +77,8 @@ def test_scrub_django_session_cookies_filtered(
}


@pytest.mark.forked
@pytest_mark_django_db_decorator()
def test_scrub_django_custom_session_cookies_filtered(
sentry_init,
client,
Expand Down

0 comments on commit e55e48e

Please sign in to comment.