This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from abc import abstractmethod, ABC | |
from typing import Callable | |
from django.conf import settings | |
from django.http import Http404 | |
from rest_framework import status | |
from rest_framework.request import Request | |
from rest_framework.response import Response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import zlib | |
def b64_decode(s): | |
pad = b'=' * (-len(s) % 4) | |
return base64.urlsafe_b64decode(s + pad) | |
def decode_session_data(session_data: str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.fixture(autouse=True, scope='session') | |
def django_cache_add_xdist_key_prefix(request): | |
skip_if_no_django() | |
# prefix like gw0_, gw1_ etc on xdist processes | |
xdist_prefix = getattr(request.config, 'slaveinput', {}).get('slaveid') | |
if not xdist_prefix: | |
return |