How to use fakeredis - 10 common examples

To help you get started, we’ve selected a few fakeredis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fengsp / rc / rc / testing.py View on Github external
def get_client(self):
        import fakeredis
        return fakeredis.FakeStrictRedis()
github seperman / redisworks / tests / tests.py View on Github external
def setUp(self):
        self.root = Root(redis=FakeStrictRedis)
        self.red = FakeStrictRedis()
github RasaHQ / rasa_core / tests / test_trackers.py View on Github external
def __init__(self, domain):
        self.red = fakeredis.FakeStrictRedis()
        self.record_exp = None
        TrackerStore.__init__(self, domain)
github jamesls / fakeredis / test_fakeredis.py View on Github external
def test_can_accept_any_kwargs(self):
        fakeredis.FakeRedis(foo='bar', bar='baz')
        fakeredis.FakeStrictRedis(foo='bar', bar='baz')
github mozilla-services / python-dockerflow / tests / flask / test_flask.py View on Github external
def test_full_redis_check(mocker):
    app = Flask("redis-check")
    app.debug = True
    redis_store = FlaskRedis.from_custom_provider(FakeStrictRedis, app)
    dockerflow = Dockerflow(app, redis=redis_store)
    assert "check_redis_connected" in dockerflow.checks

    with app.test_client() as test_client:
        response = test_client.get("/__heartbeat__")
        assert response.status_code == 200
        assert json.loads(response.data.decode())["status"] == "ok"
github botfront / rasa-for-botfront / tests / core / test_lock_store.py View on Github external
def __init__(self):
        import fakeredis

        self.red = fakeredis.FakeStrictRedis()

        # added in redis==3.3.0, but not yet in fakeredis
        self.red.connection_pool.connection_class.health_check_interval = 0

        super(RedisLockStore, self).__init__()
github carta / flipper-client / tests / contrib / test_redis.py View on Github external
def setUp(self):
        self.redis = fakeredis.FakeStrictRedis(singleton=False)
        self.store = RedisFeatureFlagStore(self.redis)
github racker / eom / tests / test_auth.py View on Github external
def fakeredis_connection():
    return fakeredis.FakeRedis()
github CityGenerator / Megacosm-Generator / tests / test_city.py View on Github external
def setUp(self):
        """ Set up the required fixtures """
        """  """
        # TODO see if testconfiguration can put a prefix on redis keys to prevent overlap
        self.redis = fakeredis.FakeRedis()
        fixtures.business.import_fixtures(self)
        fixtures.npc.import_fixtures(self)
        fixtures.region.import_fixtures(self)
        fixtures.motivation.import_fixtures(self)
        fixtures.phobia.import_fixtures(self)
        fixtures.city.import_fixtures(self)
        fixtures.organization.import_fixtures(self)
        fixtures.leader.import_fixtures(self)
        fixtures.country.import_fixtures(self)
github CityGenerator / Megacosm-Generator / tests / test_continent.py View on Github external
def setUp(self):
        """ Set up the required fixtures """
        self.redis = fakeredis.FakeRedis()

        fixtures.continent.import_fixtures(self)
        fixtures.country.import_fixtures(self)
        fixtures.leader.import_fixtures(self)
        fixtures.npc.import_fixtures(self)
        fixtures.motivation.import_fixtures(self)
        fixtures.phobia.import_fixtures(self)
        fixtures.organization.import_fixtures(self)
        fixtures.region.import_fixtures(self)
        fixtures.city.import_fixtures(self)
        fixtures.business.import_fixtures(self)
        self.redis.lpush('npc_race','gnome')
    def tearDown(self):