

def test_increment_and_get_counter(self):
    flexmock(zk.ZKTransaction)
    zk.ZKTransaction.should_receive('get_transaction_prefix_path').with_args(self.appid).and_return('/rootpath')
    fake_zookeeper = flexmock(name='fake_zoo', create='create', delete_async='delete_async', connected=(lambda : True))
    fake_zookeeper.should_receive('start')
    fake_zookeeper.should_receive('retry').and_return(None)
    fake_counter = flexmock(name='fake_counter', value='value')
    fake_counter.value = 1
    fake_counter.should_receive('__add__').and_return(2)
    fake_zookeeper.should_receive('Counter').and_return(fake_counter)
    flexmock(kazoo.client)
    kazoo.client.should_receive('KazooClient').and_return(fake_zookeeper)
    transaction = zk.ZKTransaction(host='something', start_gc=False)
    self.assertEquals((0, 1), fake_zookeeper.increment_and_get_counter(self.appid, 1))

dataset/ETHPy150Open AppScale/appscale/AppDB/test/unit/test_zookeeper.py TestZookeeperTransaction.test_increment_and_get_counter/VarMisuse@171/273 `transaction`->`fake_zookeeper`