class TestRedisBackend(BackendTestBase, TestCase): def setUp(self): # Running Redis tests on the 5th db to avoid flushing existing # redis data on 0 self.db = RedisBackend(host='localhost', port=6379, db=5, id_generator=self.id_generator) super(TestRedisBackend, self).setUp() def tearDown(self): self.db.delete_db() def test_server_unreachable(self): with self.assertRaises(ConnectionError): RedisBackend(host='unreachable', port=6379, db=5, id_generator=self.id_generator) @mock.patch('daybed.backends.redis.RedisBackend.__init__') def test_load_from_config(self, constructor_mock): constructor_mock.return_value = None config = mock.MagicMock() RedisBackend.load_from_config(config) self.assertTrue(constructor_mock.called)
class TestRedisBackend(BackendTestBase, TestCase): def setUp(self): # Running Redis tests on the 5th db to avoid flushing existing # redis data on 0 self.db = RedisBackend( host='localhost', port=6379, db=5, id_generator=self.id_generator ) super(TestRedisBackend, self).setUp() def tearDown(self): self.db.delete_db() def test_server_unreachable(self): with self.assertRaises(ConnectionError): RedisBackend( host='unreachable', port=6379, db=5, id_generator=self.id_generator ) @mock.patch('daybed.backends.redis.RedisBackend.__init__') def test_load_from_config(self, constructor_mock): constructor_mock.return_value = None config = mock.MagicMock() RedisBackend.load_from_config(config) self.assertTrue(constructor_mock.called)
def setUp(self): # Running Redis tests on the 5th db to avoid flushing existing # redis data on 0 self.db = RedisBackend(host='localhost', port=6379, db=5, id_generator=self.id_generator) super(TestRedisBackend, self).setUp()
def setUp(self): # Running Redis tests on the 5th db to avoid flushing existing # redis data on 0 self.db = RedisBackend( host='localhost', port=6379, db=5, id_generator=self.id_generator ) super(TestRedisBackend, self).setUp()
def setUp(self): # Running Redis tests on the 5th db to avoid flushing existing # redis data on 0 self.db = RedisBackend( host='localhost', port=6379, db=5, id_generator=lambda: six.text_type(uuid4()) ) super(TestRedisBackend, self).setUp()
def test_load_from_config(self, constructor_mock): constructor_mock.return_value = None config = mock.MagicMock() RedisBackend.load_from_config(config) self.assertTrue(constructor_mock.called)
def test_server_unreachable(self): with self.assertRaises(ConnectionError): RedisBackend(host='unreachable', port=6379, db=5, id_generator=self.id_generator)