Coverage for appr/models/kv/redis/db.py: 83%

# Coverage for appr/models/kv/redis/db.py : 83%

## 18 statements 15 run 3 missing 0 excluded

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from __future__ import absolute_import, division, print_function import os from appr.exception import Forbidden from appr.models.db_base import ApprDB from appr.models.kv.redis import redis_client from appr.models.kv.redis.blob import Blob from appr.models.kv.redis.channel import Channel from appr.models.kv.redis.package import Package class RedisDB(ApprDB): Channel = Channel Package = Package Blob = Blob # @TODO reset only key with prefix @classmethod def reset_db(cls, force=False): """ clean the database """ if os.getenv("APPR_DB_ALLOW_RESET", "false") == "true" or force: redis_client.flushall() else: raise Forbidden("Reset DB is deactivated") ApprDB = RedisDB