# Path: artman/pipelines/code_generation.py
# COMMON_REQUIRED = ['src_proto_path', 'import_proto_path', 'toolkit_path', 'root_dir',
#                    'output_dir', 'api_name', 'api_version',
#                    'organization_name', 'proto_package']
# COMMON_DISCO_REQUIRED = ['discovery_doc', 'toolkit_path', 'root_dir', 'output_dir',
#                          'api_name', 'api_version', 'organization_name']
# class CodeGenerationPipelineBase(pipeline_base.PipelineBase):
# class TaskFactoryBase(object):
#     def __init__(self, task_factory, **kwargs):
#     def do_build_flow(self, **kwargs):
#     def validate_kwargs(self, **kwargs):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
# def _validate_exists(required, **kwargs):
# def _validate_does_not_exist(unsupported, **kwargs):
# 
# Path: artman/pipelines/gapic_generation.py
# _GAPIC_REQUIRED = ['service_yaml', 'gapic_yaml', 'language', 'aspect']
# _DISCOGAPIC_REQUIRED = ['gapic_yaml', 'language']
# PACKAGING_TASK_FACTORY_DICT = {
#     'csharp': CSharpPackagingTaskFactory
# }
# class GapicConfigPipeline(code_gen.CodeGenerationPipelineBase):
# class DiscoGapicConfigPipeline(code_gen.CodeGenerationPipelineBase):
# class GapicConfigTaskFactory(code_gen.TaskFactoryBase):
# class DiscoGapicConfigTaskFactory(code_gen.TaskFactoryBase):
# class GapicOnlyClientPipeline(code_gen.CodeGenerationPipelineBase):
# class GapicClientPipeline(code_gen.CodeGenerationPipelineBase):
# class DiscoGapicClientPipeline(code_gen.CodeGenerationPipelineBase):
# class CSharpPackagingTaskFactory(code_gen.TaskFactoryBase):
# class GapicTaskFactory(code_gen.TaskFactoryBase):
# class DiscoGapicTaskFactory(code_gen.TaskFactoryBase):
# class GapicOnlyTaskFactory(GapicTaskFactory):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def __init__(self, language, **kwargs):
#     def __init__(self, language, **kwargs):
#     def __init__(self, language, **kwargs):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def get_tasks(self, **kwargs):
#     def _get_gapic_codegen_tasks(self, language, **kwargs):
#     def _get_grpc_codegen_tasks(self, language, **kw):
#     def _get_packaging_tasks(self, language, **kw):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def get_tasks(self, **kwargs):
#     def _get_gapic_codegen_tasks(self, language, **kwargs):
#     def _get_packaging_tasks(self, language, **kw):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def _get_grpc_codegen_tasks(self, **kw):
#     def _get_packaging_tasks(self, **kw):
# 
# Path: artman/pipelines/pipeline_base.py
# class PipelineBase(object):
# class EmptyPipeline(PipelineBase):
#     def __init__(self, **kwargs):
#     def build_flow(self, **kwargs):
#     def validate_kwargs(self, **kwargs):
#     def do_build_flow(self, **kwargs):
#     def flow(self):
#     def name(self):
#     def kwargs(self):
#     def do_build_flow(self, **kwargs):
#     def validate_kwargs(self, **kwargs):
# 
# Path: artman/tasks/io_tasks.py
# class PrepareGoogleapisDirTask(task_base.TaskBase):
# class PrepareOutputDirectoryTask(task_base.TaskBase):
#     def execute(self, root_dir, files_dict={}):
#     def execute(self, output_dir):


import unittest
import uuid
import mock
import pytest
from taskflow.patterns import linear_flow
from artman.pipelines import code_generation
from artman.pipelines import gapic_generation
from artman.pipelines import pipeline_base
from artman.tasks import io_tasks
                                  gapic_code_dir='output', aspect='ALL')
        assert isinstance(flow, linear_flow.Flow)
        assert len(flow) == 10

    def test_do_build_flow_disco(self):
        CGPB = code_generation.CodeGenerationPipelineBase
        with mock.patch.object(CGPB, 'validate_kwargs') as validate:
            cgpb = CGPB(
                gapic_generation.DiscoGapicTaskFactory(),
                language='java', aspect='ALL'
            )
            validate.assert_called_once()
        flow = cgpb.do_build_flow(language='java',
                                  gapic_code_dir='output', aspect='ALL')
        assert isinstance(flow, linear_flow.Flow)
        assert len(flow) == 6

    def test_do_build_flow_no_gapic(self):
        CGPB = code_generation.CodeGenerationPipelineBase
        with mock.patch.object(CGPB, 'validate_kwargs') as validate:
            cgpb = CGPB(
                gapic_generation.GapicTaskFactory(),
                language='python', aspect='ALL'
            )
            validate.assert_called_once()
        flow = cgpb.do_build_flow(language='python',
                                  aspect='ALL')
        assert isinstance(flow, linear_flow.Flow)
        assert len(flow) == 7


# Path: artman/pipelines/code_generation.py
# COMMON_REQUIRED = ['src_proto_path', 'import_proto_path', 'toolkit_path', 'root_dir',
#                    'output_dir', 'api_name', 'api_version',
#                    'organization_name', 'proto_package']
# COMMON_DISCO_REQUIRED = ['discovery_doc', 'toolkit_path', 'root_dir', 'output_dir',
#                          'api_name', 'api_version', 'organization_name']
# class CodeGenerationPipelineBase(pipeline_base.PipelineBase):
# class TaskFactoryBase(object):
#     def __init__(self, task_factory, **kwargs):
#     def do_build_flow(self, **kwargs):
#     def validate_kwargs(self, **kwargs):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
# def _validate_exists(required, **kwargs):
# def _validate_does_not_exist(unsupported, **kwargs):
# 
# Path: artman/pipelines/gapic_generation.py
# _GAPIC_REQUIRED = ['service_yaml', 'gapic_yaml', 'language', 'aspect']
# _DISCOGAPIC_REQUIRED = ['gapic_yaml', 'language']
# PACKAGING_TASK_FACTORY_DICT = {
#     'csharp': CSharpPackagingTaskFactory
# }
# class GapicConfigPipeline(code_gen.CodeGenerationPipelineBase):
# class DiscoGapicConfigPipeline(code_gen.CodeGenerationPipelineBase):
# class GapicConfigTaskFactory(code_gen.TaskFactoryBase):
# class DiscoGapicConfigTaskFactory(code_gen.TaskFactoryBase):
# class GapicOnlyClientPipeline(code_gen.CodeGenerationPipelineBase):
# class GapicClientPipeline(code_gen.CodeGenerationPipelineBase):
# class DiscoGapicClientPipeline(code_gen.CodeGenerationPipelineBase):
# class CSharpPackagingTaskFactory(code_gen.TaskFactoryBase):
# class GapicTaskFactory(code_gen.TaskFactoryBase):
# class DiscoGapicTaskFactory(code_gen.TaskFactoryBase):
# class GapicOnlyTaskFactory(GapicTaskFactory):
#     def __init__(self, **kwargs):
#     def __init__(self, **kwargs):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def __init__(self, language, **kwargs):
#     def __init__(self, language, **kwargs):
#     def __init__(self, language, **kwargs):
#     def get_tasks(self, **kwargs):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def get_tasks(self, **kwargs):
#     def _get_gapic_codegen_tasks(self, language, **kwargs):
#     def _get_grpc_codegen_tasks(self, language, **kw):
#     def _get_packaging_tasks(self, language, **kw):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def get_tasks(self, **kwargs):
#     def _get_gapic_codegen_tasks(self, language, **kwargs):
#     def _get_packaging_tasks(self, language, **kw):
#     def get_validate_kwargs(self):
#     def get_invalid_kwargs(self):
#     def _get_grpc_codegen_tasks(self, **kw):
#     def _get_packaging_tasks(self, **kw):
# 
# Path: artman/pipelines/pipeline_base.py
# class PipelineBase(object):
# class EmptyPipeline(PipelineBase):
#     def __init__(self, **kwargs):
#     def build_flow(self, **kwargs):
#     def validate_kwargs(self, **kwargs):
#     def do_build_flow(self, **kwargs):
#     def flow(self):
#     def name(self):
#     def kwargs(self):
#     def do_build_flow(self, **kwargs):
#     def validate_kwargs(self, **kwargs):
# 
# Path: artman/tasks/io_tasks.py
# class PrepareGoogleapisDirTask(task_base.TaskBase):
# class PrepareOutputDirectoryTask(task_base.TaskBase):
#     def execute(self, root_dir, files_dict={}):
#     def execute(self, output_dir):


# Path: test/pipelines/test_code_generation.py
import unittest
import uuid
import mock
import pytest
from taskflow.patterns import linear_flow
from artman.pipelines import code_generation
from artman.pipelines import gapic_generation
from artman.pipelines import pipeline_base
from artman.tasks import io_tasks

                                  gapic_code_dir='output', aspect='ALL')
        assert isinstance(flow, linear_flow.Flow)
        assert len(flow) == 10

    def test_do_build_flow_disco(self):
        CGPB = code_generation.CodeGenerationPipelineBase
        with mock.patch.object(CGPB, 'validate_kwargs') as validate:
            cgpb = CGPB(
                gapic_generation.DiscoGapicTaskFactory(),
                language='java', aspect='ALL'
            )
            validate.assert_called_once()
        flow = cgpb.do_build_flow(language='java',
                                  gapic_code_dir='output', aspect='ALL')
        assert isinstance(flow, linear_flow.Flow)
        assert len(flow) == 6

    def test_do_build_flow_no_gapic(self):
        CGPB = code_generation.CodeGenerationPipelineBase
        with mock.patch.object(CGPB, 'validate_kwargs') as validate:
            cgpb = CGPB(
                gapic_generation.GapicTaskFactory(),
                language='python', aspect='ALL'
            )
            validate.assert_called_once()
        flow = cgpb.do_build_flow(language='python',
                                  aspect='ALL')
        assert isinstance(flow, linear_flow.Flow)
        assert len(flow) == 7


    @mock.patch.object(code_generation, '_validate_exists')