Beispiel #1
0
 def test_execute(self, exec_command, check_output):
     task = gapic_tasks.GapicCodeGenTask()
     task.execute(api_name='pubsub',
                  api_version='v1',
                  descriptor_set='/path/to/desc',
                  gapic_yaml='/path/to/pubsub.yaml',
                  gapic_code_dir='/path/to/output',
                  language='python',
                  organization_name='google-cloud',
                  package_metadata_yaml='/path/to/pmy.yaml',
                  service_yaml='/path/to/service.yaml',
                  toolkit_path='/path/to/toolkit',
                  aspect='ALL',
                  generator_args='--extra_args',
                  proto_package='')
     expected_cmds = [
         ' '.join([
             'java -cp',
             '/path/to/toolkit/build/libs/gapic-generator-latest-fatjar.jar',
             'com.google.api.codegen.GeneratorMain LEGACY_GAPIC_AND_PACKAGE',
             '--descriptor_set=/path/to/desc --package_yaml2=/path/to/pmy.yaml',
             '--output=/path/to/output --language=python',
             '--service_yaml=/path/to/service.yaml',
             '--gapic_yaml=/path/to/pubsub.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)
Beispiel #2
0
 def test_execute(self, exec_command):
     task = gapic_tasks.GapicCodeGenTask()
     task.execute(api_name='pubsub',
                  api_version='v1',
                  descriptor_set='/path/to/desc',
                  gapic_api_yaml='pubsub.yaml',
                  gapic_code_dir='api-client-staging/generated/python',
                  gapic_language_yaml='python.yaml',
                  language='python',
                  organization_name='google-cloud',
                  package_metadata_yaml='pmy.yaml',
                  service_yaml='service.yaml',
                  toolkit_path='/path/to/toolkit')
     expected_cmds = (
         '/path/to/toolkit/gradlew -p /path/to/toolkit runCodeGen', )
     for call, expected in zip(exec_command.mock_calls, expected_cmds):
         _, args, _ = call
         assert expected in ' '.join(args[0])
Beispiel #3
0
 def test_validate(self):
     task = gapic_tasks.GapicCodeGenTask()
     assert task.validate() == [gapic_requirements.GapicRequirements]