def testMultipleOps(self):
    def _OpMethod(client, callback):
      self._method_count += 1
      callback()
      if self._method_count == 3:
        self.io_loop.add_callback(self.stop)

    def _OnWait():
      self._wait_count += 1

    op_mgr = self._CreateOpManager(handlers=[_OpMethod])

    op = self._CreateTestOp(user_id=1, handler=_OpMethod)
    op_mgr.MaybeExecuteOp(self._client, op.user_id, op.operation_id, wait_callback=_OnWait)

    op = self._CreateTestOp(user_id=2, handler=_OpMethod)
    op_mgr.MaybeExecuteOp(self._client, op.user_id, op.operation_id)

    op = self._CreateTestOp(user_id=1, handler=_OpMethod)
    op_mgr.MaybeExecuteOp(self._client, op.user_id, op.operation_id)

    self.wait()
    self.assertEqual(self._wait_count, 1)

    self._RunAsync(op_mgr.Drain)
Test multiple operations executed by OpManager.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/test/op_manager_test.py/OpManagerTestCase.testMultipleOps