

def test_get_lock_with_path(self):
    flexmock(zk.ZKTransaction)
    fake_zookeeper = flexmock(name='fake_zoo', create='create')
    fake_zookeeper.should_receive('start')
    fake_zookeeper.should_receive('retry').with_args('create', str, value=str, acl=None, ephemeral=bool).and_return(True)
    flexmock(kazoo.client)
    kazoo.client.should_receive('KazooClient').and_return(fake_zookeeper)
    transaction = zk.ZKTransaction(host='something', start_gc=False)
    self.assertEquals(True, transaction.get_lock_with_path('path'))
    transaction.should_receive('retry').with_args('create', str, value=str, acl=None, ephemeral=bool).and_raise(kazoo.exceptions.NodeExistsError)
    self.assertEquals(False, transaction.get_lock_with_path('some/path'))

dataset/ETHPy150Open AppScale/appscale/AppDB/test/unit/test_zookeeper.py TestZookeeperTransaction.test_get_lock_with_path/VarMisuse@118/180 `fake_zookeeper`->`transaction`