Exemple #1
0
 def test_match(self):
     self.redis.set("coffee:latte", "yes")
     self.redis.set("tea:rooibos", "yes")
     keys = list(scan_keys(self.redis, "coffee:*"))
     self.assertEqual(keys, ["coffee:latte"])
Exemple #2
0
 def test_single_scan_loop(self):
     expected_keys = ["key%d" % i for i in range(5)]
     for key in expected_keys:
         self.redis.set(key, "foo")
     keys = sorted(scan_keys(self.redis, "*"))
     self.assertEqual(keys, expected_keys)
Exemple #3
0
 def test_multiple_scan_loops(self):
     expected_keys = ["key%02d" % i for i in range(100)]
     for key in expected_keys:
         self.redis.set(key, "foo")
     keys = sorted(scan_keys(self.redis, "*"))
     self.assertEqual(keys, expected_keys)
Exemple #4
0
 def test_no_keys(self):
     keys = list(scan_keys(self.redis, "*"))
     self.assertEqual(keys, [])