from redis_sessions.session import SessionStore as BaseSessionStore
from redis_sessions import settings

from mtp.apps.common.tests.fake_redis import FakeStrictRedis


class SessionStore(BaseSessionStore):

    def __init__(self, session_key=None):
        """Use a fake-redis server."""
        super().__init__(session_key)

        self.server = FakeStrictRedis(
            host=settings.SESSION_REDIS_HOST,
            port=settings.SESSION_REDIS_PORT,
            db=settings.SESSION_REDIS_DB,
            password=settings.SESSION_REDIS_PASSWORD
        )
