def test_incr_calls_pool_urlopen_with_value(self): pool = mock.Mock(spec=riakcached.pools.Pool) pool.request.return_value = None, None, None pool.url = "http://127.0.0.1:8098" client = RiakClient("test_bucket", pool=pool) client.incr("test", value=5) self.assertTrue(pool.request.called) pool.request.assert_called_once_with( method="POST", url="http://127.0.0.1:8098/buckets/test_bucket/counters/test", body="5", )
def test_incr_calls_pool_urlopen_with_value(self): pool = mock.Mock(spec=riakcached.pools.Pool) pool.request.return_value = None, None, None pool.url = "http://127.0.0.1:8098" client = RiakClient("test_bucket", pool=pool) client.incr("test", value=5) self.assertTrue(pool.request.called) pool.request.assert_called_once_with( method="POST", url="http://127.0.0.1:8098/buckets/test_bucket/counters/test", body="5", )
def test_incr_invalid_status(self): pool = mock.Mock(spec=riakcached.pools.Pool) pool.request.return_value = 302, "", {} pool.url = "http://127.0.0.1:8098" client = RiakClient("test_bucket", pool=pool) self.assertFalse(client.incr("test"))
def test_incr_invalid_status(self): pool = mock.Mock(spec=riakcached.pools.Pool) pool.request.return_value = 302, "", {} pool.url = "http://127.0.0.1:8098" client = RiakClient("test_bucket", pool=pool) self.assertFalse(client.incr("test"))