def test_execute_garbage_collection(self):
    # mock out getTransactionRootPath
    flexmock(zk.ZKTransaction)
    zk.ZKTransaction.should_receive('notify_failed_transaction')

    # mock out initializing a ZK connection
    fake_zookeeper = flexmock(name='fake_zoo', exists='exists', get='get',
      get_children='get_children')
    fake_zookeeper.should_receive('start')
    fake_zookeeper.should_receive('retry').with_args('exists', str) \
      .and_return(True)
    fake_zookeeper.should_receive('retry').with_args('get', str) \
      .and_return([str(time.time() + 10000)])
    fake_zookeeper.should_receive('retry').with_args('get_children', str) \
      .and_return(['1','2','3'])

    flexmock(kazoo.client)
    kazoo.client.should_receive('KazooClient').and_return(fake_zookeeper)
    transaction = zk.ZKTransaction(host="something", start_gc=False)
    transaction.execute_garbage_collection(self.appid, "some/path")
dataset/ETHPy150Open AppScale/appscale/AppDB/test/unit/test_zookeeper.py/TestZookeeperTransaction.test_execute_garbage_collection/original