# Path: artman/tasks/gapic_tasks.py
# class GapicConfigGenTask(task_base.TaskBase):
# class DiscoGapicConfigGenTask(task_base.TaskBase):
# class GapicConfigMoveTask(task_base.TaskBase):
# class GapicCodeGenTask(task_base.TaskBase):
# class DiscoGapicCodeGenTask(task_base.TaskBase):
# class CSharpGapicPackagingTask(task_base.TaskBase):
#     def execute(self, toolkit_path, descriptor_set, service_yaml,
#                 output_dir, api_name, api_version, organization_name):
#     def execute(self, toolkit_path, discovery_doc,
#         output_dir, api_name, api_version, organization_name):
#     def _move_to(self, gapic_config_path, gapic_yaml):
#     def execute(self, gapic_config_path, gapic_yaml):
#     def validate(self):
#     def execute(self, language, toolkit_path, descriptor_set, service_yaml,
#                 gapic_yaml, package_metadata_yaml, proto_package,
#                 gapic_code_dir, api_name, api_version, organization_name,
#                 aspect, samples, generator_args, grpc_service_config=''):
#     def _get_sample_yamls(self, path):
#     def execute(self, language, toolkit_path, discovery_doc,
#         gapic_yaml, package_metadata_yaml,
#         gapic_code_dir, api_name, api_version, organization_name, root_dir):
#     def execute(self, gapic_code_dir, grpc_code_dir, proto_code_dir, gapic_yaml):


import os
import subprocess
import unittest
import mock
import pytest
from artman.tasks import gapic_tasks
                      '--output=/path/to/output --language=python',
                      '--service_yaml=/path/to/service.yaml',
                      '--gapic_yaml=/path/to/pubsub.yaml',
                      '--sample_yamls',
                      '/path/to/samples/fakedir/fakesample.yaml',
                      '--extra_args'
                      ])
        ]
        assert_calls_equal(exec_command.mock_calls, expected_cmds)

        expected_cmds2 = [
            '/path/to/toolkit/gradlew -p /path/to/toolkit fatJar -Pclargs=',
        ]
        assert_calls_equal(check_output.mock_calls, expected_cmds2)


class DiscoGapicCodeGenTaskTests(unittest.TestCase):
    @mock.patch.object(subprocess, 'check_output')
    @mock.patch.object(gapic_tasks.DiscoGapicCodeGenTask, 'exec_command')
    def test_execute(self, exec_command, check_output):
        task = gapic_tasks.DiscoGapicCodeGenTask()
        task.execute(
            api_name='compute',
            api_version='v1',
            gapic_yaml='/path/to/compute.yaml',
            gapic_code_dir='/path/to/output',
            language='java',
            organization_name='google-cloud',
            package_metadata_yaml='/path/to/pmy.yaml',
            discovery_doc="compute.v1.json",

# Path: artman/tasks/gapic_tasks.py
# class GapicConfigGenTask(task_base.TaskBase):
# class DiscoGapicConfigGenTask(task_base.TaskBase):
# class GapicConfigMoveTask(task_base.TaskBase):
# class GapicCodeGenTask(task_base.TaskBase):
# class DiscoGapicCodeGenTask(task_base.TaskBase):
# class CSharpGapicPackagingTask(task_base.TaskBase):
#     def execute(self, toolkit_path, descriptor_set, service_yaml,
#                 output_dir, api_name, api_version, organization_name):
#     def execute(self, toolkit_path, discovery_doc,
#         output_dir, api_name, api_version, organization_name):
#     def _move_to(self, gapic_config_path, gapic_yaml):
#     def execute(self, gapic_config_path, gapic_yaml):
#     def validate(self):
#     def execute(self, language, toolkit_path, descriptor_set, service_yaml,
#                 gapic_yaml, package_metadata_yaml, proto_package,
#                 gapic_code_dir, api_name, api_version, organization_name,
#                 aspect, samples, generator_args, grpc_service_config=''):
#     def _get_sample_yamls(self, path):
#     def execute(self, language, toolkit_path, discovery_doc,
#         gapic_yaml, package_metadata_yaml,
#         gapic_code_dir, api_name, api_version, organization_name, root_dir):
#     def execute(self, gapic_code_dir, grpc_code_dir, proto_code_dir, gapic_yaml):


# Path: test/tasks/test_gapic.py
import os
import subprocess
import unittest
import mock
import pytest
from artman.tasks import gapic_tasks

                      '--output=/path/to/output --language=python',
                      '--service_yaml=/path/to/service.yaml',
                      '--gapic_yaml=/path/to/pubsub.yaml',
                      '--sample_yamls',
                      '/path/to/samples/fakedir/fakesample.yaml',
                      '--extra_args'
                      ])
        ]
        assert_calls_equal(exec_command.mock_calls, expected_cmds)

        expected_cmds2 = [
            '/path/to/toolkit/gradlew -p /path/to/toolkit fatJar -Pclargs=',
        ]
        assert_calls_equal(check_output.mock_calls, expected_cmds2)


class DiscoGapicCodeGenTaskTests(unittest.TestCase):
    @mock.patch.object(subprocess, 'check_output')
    @mock.patch.object(gapic_tasks.DiscoGapicCodeGenTask, 'exec_command')
    def test_execute(self, exec_command, check_output):
        task = gapic_tasks.DiscoGapicCodeGenTask()
        task.execute(
            api_name='compute',
            api_version='v1',
            gapic_yaml='/path/to/compute.yaml',
            gapic_code_dir='/path/to/output',
            language='java',
            organization_name='google-cloud',
            package_metadata_yaml='/path/to/pmy.yaml',
            discovery_doc="compute.v1.json",

            toolkit_path='/path/to/toolkit',