Esempio n. 1
0
 def test_execute(self, exec_command, check_output):
     task = gapic_tasks.DiscoGapicConfigGenTask()
     result = task.execute(
         api_name='compute',
         api_version='v1',
         organization_name='google-cloud',
         output_dir='/path/to/output',
         discovery_doc='/path/to/discovery_doc.json',
         toolkit_path='/path/to/toolkit',
     )
     assert result == '/'.join((
         '/path/to/output/google-cloud-compute-v1-config-gen',
         'google-cloud-compute-v1_gapic.yaml',
     ))
     expected_cmds = [
         'mkdir -p %s' % os.path.dirname(result), ' '.join([
             'java -cp',
             '/path/to/toolkit/build/libs/gapic-generator-latest-fatjar.jar',
             'com.google.api.codegen.GeneratorMain',
             'DISCOGAPIC_CONFIG',
             '--discovery_doc=/path/to/discovery_doc.json',
             '--output=/path/to/output/google-cloud-compute-v1-config-gen/google-cloud-compute-v1_gapic.yaml',
         ])
     ]
     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)
Esempio n. 2
0
 def test_execute(self, exec_command):
     task = gapic_tasks.DiscoGapicConfigGenTask()
     result = task.execute(
         api_name='compute',
         api_version='v1',
         organization_name='google-cloud',
         output_dir='/path/to/output',
         discovery_doc='/path/to/discovery_doc.json',
         toolkit_path='/path/to/toolkit',
     )
     assert result == '/'.join((
         '/path/to/output/google-cloud-compute-v1-config-gen',
         'google-cloud-compute-v1_gapic.yaml',
     ))
     expected_cmds = (
         'mkdir -p %s' % os.path.dirname(result),
         ''.join((
             '/path/to/toolkit/gradlew -p /path/to/toolkit runDiscoConfigGen '
             '-Pclargs=',
             '--discovery_doc=',
             '/path/to/discovery_doc.json,'
             '--output=/path/to/output/google-cloud-compute-v1-config-gen/',
             'google-cloud-compute-v1_gapic.yaml',
         )),
     )
     for call, expected in zip(exec_command.mock_calls, expected_cmds):
         _, args, _ = call
         cmd = ' '.join(args[0])
         assert cmd == expected
Esempio n. 3
0
 def test_validate(self):
     task = gapic_tasks.DiscoGapicConfigGenTask()
     assert task.validate() == [gapic_requirements.ConfigGenRequirements]