Beispiel #1
0
    def test_expireat_loads(self):
        self.r.delete('b')
        dump = '''{"b":{"type":"string","value":"bbb","expireat":_time.time() + 3600}}'''
        io = StringIO(dump)
        redisdl.load_lump(io)

        ttl = self.r.ttl('b')

        self.assertGreater(ttl, 0)
        self.assertLessEqual(ttl, 3600)
Beispiel #2
0
    def test_expireat_loads(self):
        self.r.delete("b")
        dump = """{"b":{"type":"string","value":"bbb","expireat":%d}}""" % (_time.time() + 3600)
        io = StringIO(dump)
        redisdl.load_lump(io)

        ttl = self.r.ttl("b")

        self.assertGreater(ttl, 0)
        self.assertLessEqual(ttl, 3600)
Beispiel #3
0
    def test_ttl_loads(self):
        self.r.delete("b")
        dump = """{"b":{"type":"string","value":"bbb","ttl":3600}}"""
        io = StringIO(dump)
        redisdl.load_lump(io)

        ttl = self.r.ttl("b")

        self.assertGreater(ttl, 0)
        self.assertLessEqual(ttl, 3600)
Beispiel #4
0
 def test_load_bytesio_lump(self):
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = BytesIO(dump.encode('utf-8'))
     redisdl.load_lump(io)
     value = self.r.get('key')
     self.assertEqual('hello, world', value.decode('ascii'))
 def test_load_stringio_lump(self):
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = StringIO(dump)
     redisdl.load_lump(io)
     value = self.r.get('key')
     self.assertEqual('hello, world', value.decode('ascii'))
Beispiel #6
0
 def test_load_bytesio_lump(self):
     dump = '{"key":{"type":"string","value":"hello, world"}}'
     io = BytesIO(dump.encode("utf-8"))
     redisdl.load_lump(io)
     value = self.r.get("key")
     self.assertEqual("hello, world", value.decode("ascii"))