def test__cancel_grpc(): operations_stub = mock.Mock(spec=["CancelOperation"]) operation._cancel_grpc(operations_stub, TEST_OPERATION_NAME) expected_request = operations_pb2.CancelOperationRequest(name=TEST_OPERATION_NAME) operations_stub.CancelOperation.assert_called_once_with(expected_request)