def redis_restore(tempfile):
    with open(tempfile, 'r') as f:
        redisdl.load(
            f,
            host=config.REDIS_HOST,
            password=config.REDIS_PASSWORD
        )
def redis_restore(redis_creds, tempfile):
    with open(tempfile, 'r') as f:
        redisdl.load(
            f,
            host=redis_creds['host'],
            password=redis_creds['password'],
        )
示例#3
0
        def test_load_bytesio_yajl2_backend_str(self):
            self.assertTrue(redisdl.have_streaming_load)

            dump = '{"key":{"type":"string","value":"hello, world"}}'
            io = StringIO(dump)
            redisdl.load(io)
            value = self.r.get('key')
            self.assertEqual('hello, world', value.decode('ascii'))
示例#4
0
        def test_load_bytesio(self):
            self.assertTrue(redisdl.have_streaming_load)

            dump = '{"key":{"type":"string","value":"hello, world"}}'
            io = BytesIO(dump.encode('utf-8'))
            redisdl.load(io)
            value = self.r.get('key')
            self.assertEqual('hello, world', value.decode('ascii'))
示例#5
0
 def test_load_bytesio(self):
     self.assertTrue(redisdl.have_streaming_load)
     
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = BytesIO(dump.encode('utf-8'))
     redisdl.load(io)
     value = self.r.get('key')
     self.assertEqual('hello, world', value.decode('ascii'))
示例#6
0
 def test_load_stringio_python_backend_local(self):
     self.assertTrue(redisdl.have_streaming_load)
     
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = StringIO(dump)
     redisdl.load(io, streaming_backend='python')
     value = self.r.get('key')
     self.assertEqual('hello, world', value.decode('ascii'))
示例#7
0
        def test_load_bytesio_yajl2_backend_str(self):
            self.assertTrue(redisdl.have_streaming_load)

            dump = '{"key":{"type":"string","value":"hello, world"}}'
            io = StringIO(dump)
            redisdl.load(io)
            value = self.r.get("key")
            self.assertEqual("hello, world", value.decode("ascii"))
示例#8
0
    def test_load_stringio_python_backend_global(self):
        self.assertTrue(redisdl.have_streaming_load)
        redisdl.streaming_backend = "python"

        dump = '{"key":{"type":"string","value":"hello, world"}}'
        io = StringIO(dump)
        redisdl.load(io)
        value = self.r.get("key")
        self.assertEqual("hello, world", value.decode("ascii"))
示例#9
0
 def test_load_stringio_no_backend(self):
     if have_streaming_load:
         self.assertTrue(redisdl.have_streaming_load)
     redisdl.streaming_backend = None
     
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = StringIO(unicode(dump))
     redisdl.load(io)
     value = self.r.get('key')
     self.assertEqual('hello, world', value.decode('ascii'))
示例#10
0
    def do_load(options, args):
        if len(args) > 0:
            input = open(args[0], 'rb')
        else:
            input = sys.stdin

        kwargs = options_to_kwargs(options)
        load(input, **kwargs)

        if len(args) > 0:
            input.close()
示例#11
0
 def test_load_stringio_bytes(self):
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = BytesIO(dump.encode('ascii'))
     redisdl.load(io)
     value = self.r.get('key')
     self.assertEqual('hello, world', value.decode('ascii'))
示例#12
0
 def restore(self):
   with open('%scategories/dump%s.json' % (persistence_path(), self.db), "r+") as f:
     redisdl.load(f, db=self.db, host=self.host, port=self.port)
示例#13
0
 def test_load_stringio_bytes(self):
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = BytesIO(dump.encode("ascii"))
     redisdl.load(io)
     value = self.r.get("key")
     self.assertEqual("hello, world", value.decode("ascii"))
示例#14
0
# requires pip install redis-dump-load
import redisdl

with open('redis-dump.json') as f:
    redisdl.load(f)