def test_failure_callback_application(self): new_cxn = mock.Mock() callback = mock.Mock(name="callback", return_value=new_cxn) cxn = self.makeone(port=0, failure_callback=callback) out = cxn.connect() assert callback.called assert out is new_cxn assert len(callback.call_args) and len(callback.call_args[0]) == 2, callback.call_args cxn_in, error = callback.call_args[0] assert isinstance(error, redis.ConnectionError) assert cxn_in is cxn
def test_def_callback_raises_on_bad_cxn(self): cxn = self.makeone(port=0) cxn.connect()