Exemple #1
0
 def test_execute_bad_src_path(self, exec_command):
     src_proto_path = ['test/tasks/data/googleapis/groogle/pubsub/v1']
     grpc_code_dir = 'grpc_code_dir'
     task = protoc_tasks.JavaProtoCopyTask()
     with pytest.raises(ValueError):
         task.execute(src_proto_path, grpc_code_dir)
     assert exec_command.call_count == 0
Exemple #2
0
 def test_execute(self, exec_command):
     src_proto_path = ['test/tasks/data/googleapis/google/pubsub/v1']
     grpc_code_dir = 'grpc_code_dir'
     task = protoc_tasks.JavaProtoCopyTask()
     task.execute(src_proto_path, grpc_code_dir)
     assert exec_command.call_count == 2
     expected_cmds = (
         'mkdir -p grpc_code_dir/src/main/proto/google/pubsub/v1',
         'cp test/tasks/data/googleapis/google/pubsub/v1/pubsub.proto ' +
         'grpc_code_dir/src/main/proto/google/pubsub/v1/pubsub.proto',
     )
     for call, expected in zip(exec_command.mock_calls, expected_cmds):
         _, args, _ = call
         assert ' '.join(args[0]) == expected