class TestString(unittest.TestCase): def setUp(self): connect() self.redispy = redis.Redis() self.redispy.flushdb() self.name = 'pi' self.value = 3.14 self.key = String(self.name) def tearDown(self): self.redispy.flushdb() # __repr__ def test_repr(self): self.key.set(self.value) self.assertEqual( repr(self.key), format_key(self.key, self.name, self.value) )
class TestRemoteServer(unittest.TestCase): def setUp(self): # ooredis connect("test", **redis_dbs["test"]) # redis-py self.r = redis.Redis(**redis_dbs["test"]) self.r.flushdb() def test_set_and_get(self): self.s = String('key', db_key="test") self.s.set('value') self.assertEqual(self.s.get(), 'value') self.assertTrue(self.r.exists('key')) self.assertEqual(self.r.get('key'), self.s.get())
class TestRemoteServer(unittest.TestCase): def setUp(self): # ooredis connect("test",**redis_dbs["test"]) # redis-py self.r = redis.Redis(**redis_dbs["test"]) self.r.flushdb() def test_set_and_get(self): self.s = String('key',db_key="test") self.s.set('value') self.assertEqual(self.s.get(), 'value') self.assertTrue(self.r.exists('key')) self.assertEqual(self.r.get('key'), self.s.get())
class TestRemoteServer(unittest.TestCase): def setUp(self): self.host = '127.0.0.1' # ooredis connect(host=self.host) # redis-py self.r = redis.Redis(host=self.host) self.r.flushdb() def test_set_and_get(self): self.s = String('key') self.s.set('value') self.assertEqual(self.s.get(), 'value') self.assertTrue(self.r.exists('key')) self.assertEqual(self.r.get('key'), self.s.get())
class TestString(unittest.TestCase): def setUp(self): connect() self.redispy = redis.Redis() self.redispy.flushdb() self.name = 'pi' self.value = 3.14 self.key = String(self.name) def tearDown(self): self.redispy.flushdb() # __repr__ def test_repr(self): self.key.set(self.value) self.assertEqual(repr(self.key), format_key(self.key, self.name, self.value))