| 1 |
from functools import partial |
| 2 |
|
| 3 |
import pytest |
| •4 |
import sys |
| 5 |
if sys.version_info > (3, 12): |
| 6 |
pytestmark = pytest.mark.skipif(reason="For Python3 >= 3.12 dateutils throws DeprecationWarning which breaks the following tests which are ignored here") |
| 7 |
|
| 8 |
from itsdangerous.url_safe import URLSafeSerializer |
| 9 |
from itsdangerous.url_safe import URLSafeTimedSerializer |
| 10 |
from test_itsdangerous.test_serializer import TestSerializer |
| 11 |
from test_itsdangerous.test_timed import TestTimedSerializer |
| 12 |
|
| 13 |
|
| 14 |
class TestURLSafeSerializer(TestSerializer): |
| 15 |
@pytest.fixture() |
| 16 |
def serializer_factory(self): |
| 17 |
return partial(URLSafeSerializer, secret_key="secret-key") |
| 18 |
|
| 19 |
@pytest.fixture(params=({"id": 42}, pytest.param("a" * 1000, id="zlib"))) |
| 20 |
def value(self, request): |
| 21 |
return request.param |
| 22 |
|
| 23 |
|
| 24 |
class TestURLSafeTimedSerializer(TestURLSafeSerializer, TestTimedSerializer): |
| 25 |
@pytest.fixture() |
| 26 |
def serializer_factory(self): |
| 27 |
return partial(URLSafeTimedSerializer, secret_key="secret-key") |