diff --git a/gapic-generator-cloud/templates/cloud/wrapper_gem/client_test.erb b/gapic-generator-cloud/templates/cloud/wrapper_gem/client_test.erb index a9c0a4b4c..7cd0a3eda 100644 --- a/gapic-generator-cloud/templates/cloud/wrapper_gem/client_test.erb +++ b/gapic-generator-cloud/templates/cloud/wrapper_gem/client_test.erb @@ -12,11 +12,21 @@ require "gapic/rest" <%- end -%> class <%= gem.namespace %>::ClientConstructionMinitest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + <%- start_line_spacer -%> <%- gem.services.each do |service| -%> <%- if service.generate_grpc_clients? -%> <%= line_spacer %> def test_<%= service.factory_method_name %>_grpc - Gapic::ServiceStub.stub :new, :stub do + Gapic::ServiceStub.stub :new, DummyStub.new do grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure client = <%= gem.namespace %>.<%= service.factory_method_name %><% if service.supports_multiple_transports? %> transport: :grpc<% end %> do |config| config.credentials = grpc_channel @@ -27,7 +37,7 @@ class <%= gem.namespace %>::ClientConstructionMinitest < Minitest::Test <%- end -%> <%- if service.generate_rest_clients? -%> <%= line_spacer %> def test_<%= service.factory_method_name %>_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = <%= gem.namespace %>.<%= service.factory_method_name %><% if service.supports_multiple_transports? %> transport: :rest<% end %> do |config| config.credentials = :dummy_credentials end diff --git a/shared/output/cloud/compute_small_wrapper/test/google/cloud/compute/client_test.rb b/shared/output/cloud/compute_small_wrapper/test/google/cloud/compute/client_test.rb index ee2c20674..71bcc2545 100644 --- a/shared/output/cloud/compute_small_wrapper/test/google/cloud/compute/client_test.rb +++ b/shared/output/cloud/compute_small_wrapper/test/google/cloud/compute/client_test.rb @@ -22,8 +22,18 @@ require "gapic/rest" class Google::Cloud::Compute::ClientConstructionMinitest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + def test_addresses_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = Google::Cloud::Compute.addresses do |config| config.credentials = :dummy_credentials end @@ -32,7 +42,7 @@ def test_addresses_rest end def test_region_operations_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = Google::Cloud::Compute.region_operations do |config| config.credentials = :dummy_credentials end @@ -41,7 +51,7 @@ def test_region_operations_rest end def test_region_instance_group_managers_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = Google::Cloud::Compute.region_instance_group_managers do |config| config.credentials = :dummy_credentials end @@ -50,7 +60,7 @@ def test_region_instance_group_managers_rest end def test_networks_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = Google::Cloud::Compute.networks do |config| config.credentials = :dummy_credentials end @@ -59,7 +69,7 @@ def test_networks_rest end def test_global_operations_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = Google::Cloud::Compute.global_operations do |config| config.credentials = :dummy_credentials end diff --git a/shared/output/cloud/language_wrapper/test/google/cloud/language/client_test.rb b/shared/output/cloud/language_wrapper/test/google/cloud/language/client_test.rb index 831b338cd..e417ec836 100644 --- a/shared/output/cloud/language_wrapper/test/google/cloud/language/client_test.rb +++ b/shared/output/cloud/language_wrapper/test/google/cloud/language/client_test.rb @@ -23,8 +23,18 @@ require "gapic/rest" class Google::Cloud::Language::ClientConstructionMinitest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + def test_language_service_grpc - Gapic::ServiceStub.stub :new, :stub do + Gapic::ServiceStub.stub :new, DummyStub.new do grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure client = Google::Cloud::Language.language_service transport: :grpc do |config| config.credentials = grpc_channel @@ -34,7 +44,7 @@ def test_language_service_grpc end def test_language_service_rest - Gapic::Rest::ClientStub.stub :new, :stub do + Gapic::Rest::ClientStub.stub :new, DummyStub.new do client = Google::Cloud::Language.language_service transport: :rest do |config| config.credentials = :dummy_credentials end diff --git a/shared/output/cloud/secretmanager_wrapper/test/google/cloud/secret_manager/client_test.rb b/shared/output/cloud/secretmanager_wrapper/test/google/cloud/secret_manager/client_test.rb index 6d059a4b1..aebca0989 100644 --- a/shared/output/cloud/secretmanager_wrapper/test/google/cloud/secret_manager/client_test.rb +++ b/shared/output/cloud/secretmanager_wrapper/test/google/cloud/secret_manager/client_test.rb @@ -22,8 +22,18 @@ require "gapic/grpc" class Google::Cloud::SecretManager::ClientConstructionMinitest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + end + def test_secret_manager_service_grpc - Gapic::ServiceStub.stub :new, :stub do + Gapic::ServiceStub.stub :new, DummyStub.new do grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure client = Google::Cloud::SecretManager.secret_manager_service do |config| config.credentials = grpc_channel