Exemple #1
0
 def test_constructor_with_id(self, StrictRedis):
     with patch.dict(redis_config, {
             "host": "some.redis.host",
             "port": 11111,
             "db": 0,
             "password": "******"
     },
                     clear=True):
         r = RedisObject(id='i_have_an_id')
         StrictRedis.assert_called_with(db=0,
                                        decode_responses=True,
                                        host='some.redis.host',
                                        password='******',
                                        port=11111)
         self.assertEqual(r.id, 'RedisObject:i_have_an_id')
Exemple #2
0
 def test_constructor_without_id(self, StrictRedis, urandom):
     urandom.return_value = '\xd8X\xfa@\x97\x90\x00dr'
     with patch.dict(redis_config, {
             "host": "some.redis.host",
             "port": 11111,
             "db": 0,
             "password": "******"
     },
                     clear=True):
         r = RedisObject()
         StrictRedis.assert_called_with(db=0,
                                        decode_responses=True,
                                        host='some.redis.host',
                                        password='******',
                                        port=11111)
         self.assertEqual(r.id, u'RedisObject:2Fj6QJeQAGRy')