Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@ def test_<%= method.name %>
<%= method.service.rest.service_name_full %>::<%= method.service.rest.service_stub_name %>.stub :<%= method.rest.transcoding_helper_name %>, ["", "", {}] do
Gapic::Rest::ClientStub.stub :new, <%= method.name %>_client_stub do
# Create client
client = <%= full_client_name %>.new do |config|
client_stub = <%= full_client_name %>.new do |config|
config.credentials = :dummy_value
end

# Use hash object
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end

<%- if fields.any? -%>
# Use named arguments
client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
client_stub.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end

<%- end -%>
# Use protobuf object
client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
client_stub.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end

# Use hash object with options
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end

# Use protobuf object with options
client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
client_stub.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@ def test_<%= method.name %>
<%= method.service.rest.service_name_full %>::<%= method.service.rest.service_stub_name %>.stub :<%= method.rest.transcoding_helper_name %>, ["", "", {}] do
Gapic::Rest::ClientStub.stub :new, <%= method.name %>_client_stub do
# Create client
client = <%= full_client_name %>.new do |config|
client_stub = <%= full_client_name %>.new do |config|
config.credentials = :dummy_value
end

# Use hash object
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end.first

<%- if fields.any? -%>
# Use named arguments
client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
client_stub.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end.first

<%- end -%>
# Use protobuf object
client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
client_stub.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end.first

# Use hash object with options
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, call_options) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end.first

# Use protobuf object with options
client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
client_stub.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), call_options) do |_result, response|
<%= indent_tail render(partial: "service/rest/test/method/assert_response", locals: { method: method }), 6 %>
end.first

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def test_<%= method.name %>

Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
# Create client
client = <%= full_client_name %>.new do |config|
client_stub = <%= full_client_name %>.new do |config|
config.credentials = grpc_channel
end

# Use enumerable object with hash and protobuf object.
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
enum_input = [request_hash, request_proto].to_enum
client.<%= method.name %> enum_input do |response, operation|
client_stub.<%= method.name %> enum_input do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -42,7 +42,7 @@ def test_<%= method.name %>
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
stream_input = Gapic::StreamInput.new
client.<%= method.name %> stream_input do |response, operation|
client_stub.<%= method.name %> stream_input do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -57,7 +57,7 @@ def test_<%= method.name %>
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
enum_input = [request_hash, request_proto].to_enum
client.<%= method.name %> enum_input, grpc_options do |response, operation|
client_stub.<%= method.name %> enum_input, grpc_options do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -69,7 +69,7 @@ def test_<%= method.name %>
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
stream_input = Gapic::StreamInput.new
client.<%= method.name %> stream_input, grpc_options do |response, operation|
client_stub.<%= method.name %> stream_input, grpc_options do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ def test_<%= method.name %>

Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
# Create client
client = <%= full_client_name %>.new do |config|
client_stub = <%= full_client_name %>.new do |config|
config.credentials = grpc_channel
end

# Use enumerable object with hash and protobuf object.
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
enum_input = [request_hash, request_proto].to_enum
client.<%= method.name %> enum_input do |response, operation|
client_stub.<%= method.name %> enum_input do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

# Use stream input object (from gapic-common).
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
stream_input = Gapic::StreamInput.new
client.<%= method.name %> stream_input do |response, operation|
client_stub.<%= method.name %> stream_input do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end
stream_input << request_hash
Expand All @@ -49,15 +49,15 @@ def test_<%= method.name %>
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
enum_input = [request_hash, request_proto].to_enum
client.<%= method.name %> enum_input, grpc_options do |response, operation|
client_stub.<%= method.name %> enum_input, grpc_options do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

# Use stream input object (from gapic-common) with options.
request_hash = { <%= fields.map(&:as_kwarg).join ", " %> }
request_proto = <%= method.request_type %>.new <%= fields.map(&:as_kwarg).join ", " %>
stream_input = Gapic::StreamInput.new
client.<%= method.name %> stream_input, grpc_options do |response, operation|
client_stub.<%= method.name %> stream_input, grpc_options do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end
stream_input << request_hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,34 @@ def test_<%= method.name %>

Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
# Create client
client = <%= full_client_name %>.new do |config|
client_stub = <%= full_client_name %>.new do |config|
config.credentials = grpc_channel
end

# Use hash object
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

<%- if fields.any? -%>
# Use named arguments
client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
client_stub.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

<%- end -%>
# Use protobuf object
client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
client_stub.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

# Use hash object with options
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

# Use protobuf object with options
client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
client_stub.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
<%= indent_tail render(partial: "service/test/method/assert_response", locals: { method: method }), 6 %>
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def test_<%= method.name %>

Gapic::ServiceStub.stub :new, <%= method.name %>_client_stub do
# Create client
client = <%= full_client_name %>.new do |config|
client_stub = <%= full_client_name %>.new do |config|
config.credentials = grpc_channel
end

# Use hash object
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -52,7 +52,7 @@ def test_<%= method.name %>
end

# Use named arguments
client.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
client_stub.<%= method.name %> <%= fields.map(&:as_kwarg).join ", " %> do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -61,7 +61,7 @@ def test_<%= method.name %>
end

# Use protobuf object
client.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
client_stub.<%= method.name %> <%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -70,7 +70,7 @@ def test_<%= method.name %>
end

# Use hash object with options
client.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
client_stub.<%= method.name %>({ <%= fields.map(&:as_kwarg).join ", " %> }, grpc_options) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand All @@ -79,7 +79,7 @@ def test_<%= method.name %>
end

# Use protobuf object with options
client.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
client_stub.<%= method.name %>(<%= method.request_type %>.new(<%= fields.map(&:as_kwarg).join ", " %>), grpc_options) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of <%= method.return_type %>, r
Expand Down
Loading
Loading