def setUp(self): self.assertTrue(ping()) # assert Redis is up create("key_xubiru", '{"key": "value"}') create("key_xubiru2", '{"key": "value"}') create("/home", '{"status": "Dishes cleaned up", "meta": {"cache": "HIT"}}') create("/grave", '{"status": "Sleeping", "meta": {"cache": "HIT"}}')
def setUp(self): self.assertTrue(ping()) # assert Redis is up create(u"_@@_@@http://Charles@@xubiru##instance", {}) create( u"_@@_@@http://NinaFox@@class_uri=http://dog&instance_uri=http://NinaFox##instance", "something") create(u"_@@_@@http://NinaFox@@xubiru=##instance##instance", "something") create(u"_@@_@@http://NinaFox@@abc##instance", "something")
def test_update_if_present_when_it_is_present(self): response = create("to_update_key", '{"key": "old value"}') self.assertTrue(response) response = retrieve("to_update_key") self.assertEqual(response, {"key": "old value"}) response = update_if_present("to_update_key", '{"key": "up-to-date value"}') self.assertTrue(response) response = retrieve("to_update_key") self.assertEqual(response["body"], u'{"key": "up-to-date value"}')
def setUp(self): self.assertTrue(ping()) # assert Redis is up delete("inexistent_url") create("some_url", "any value") create("some_other_url", "another value") create("problematic_key", "another value")
def test_create(self): response = create("new_key", "some value") self.assertTrue(response) ttl = redis_client.ttl("new_key") self.assertGreater(ttl, 80000)
def setUp(self): self.assertTrue(ping()) # assert Redis is up create("non_default_key", {}) create("_@@_@@inst_a##instance", {}) create("_@@_@@inst_b@@a=1&b=2##instance", {}) create("_##json_schema", {}) create("_##root", {}) create("some_graph@@some_instance##class", {})
def setUp(self): self.assertTrue(ping()) # assert Redis is up create(u"_@@_@@http://Charles@@xubiru##instance", {}) create(u"_@@_@@http://NinaFox@@class_uri=http://dog&instance_uri=http://NinaFox##instance", "something") create(u"_@@_@@http://NinaFox@@xubiru=##instance##instance", "something") create(u"_@@_@@http://NinaFox@@abc##instance", "something")
def test_flushall_after_import_cache(self): cache.create('any_key', 1) self.assertEqual(cache.retrieve('any_key'), 1) cache.flushall() self.assertEqual(cache.keys('*'), [])