test_url_safe.py 777 B

123456789101112131415161718192021222324
  1. from functools import partial
  2. import pytest
  3. from itsdangerous.url_safe import URLSafeSerializer
  4. from itsdangerous.url_safe import URLSafeTimedSerializer
  5. from __tests__.test_serializer import TestSerializer
  6. from __tests__.test_timed import TestTimedSerializer
  7. class TestURLSafeSerializer(TestSerializer):
  8. @pytest.fixture()
  9. def serializer_factory(self):
  10. return partial(URLSafeSerializer, secret_key="secret-key")
  11. @pytest.fixture(params=({"id": 42}, pytest.param("a" * 1000, id="zlib")))
  12. def value(self, request):
  13. return request.param
  14. class TestURLSafeTimedSerializer(TestURLSafeSerializer, TestTimedSerializer):
  15. @pytest.fixture()
  16. def serializer_factory(self):
  17. return partial(URLSafeTimedSerializer, secret_key="secret-key")