Example #1
0
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)
        )
Example #2
0
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())
Example #3
0
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())
Example #4
0
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())
Example #5
0
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))