Skip to content

Commit

Permalink
update test cases for lib name and version
Browse files Browse the repository at this point in the history
  • Loading branch information
jiren committed Feb 12, 2020
1 parent 63349f4 commit 7fb2800
Showing 1 changed file with 45 additions and 24 deletions.
69 changes: 45 additions & 24 deletions google-cloud-spanner/test/google/cloud/spanner_test.rb
Expand Up @@ -125,13 +125,16 @@ def creds.is_a? target
"spanner-credentials"
}
stubbed_service = ->(project, credentials, timeout: nil, host: nil, client_config: nil, **keyword_args) {

project.must_equal "project-id"
credentials.must_equal "spanner-credentials"
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -193,8 +196,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -223,8 +228,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_equal endpoint
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand All @@ -251,8 +258,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -286,8 +295,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}
empty_env = OpenStruct.new
Expand Down Expand Up @@ -410,8 +421,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -450,8 +463,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -490,8 +505,10 @@ def creds.is_a? target
timeout.must_equal 42
host.must_be :nil?
client_config.must_equal spanner_client_config
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -532,8 +549,10 @@ def creds.is_a? target
timeout.must_equal 42
host.must_be :nil?
client_config.must_equal spanner_client_config
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -575,8 +594,10 @@ def creds.is_a? target
timeout.must_be :nil?
host.must_equal endpoint
client_config.must_be :nil?
lib_name.must_be :nil?
lib_version.must_be :nil?
keyword_args.key?(:lib_name).must_equal true
keyword_args.key?(:lib_version).must_equal true
keyword_args[:lib_name].must_be :nil?
keyword_args[:lib_version].must_be :nil?
OpenStruct.new project: project
}

Expand Down Expand Up @@ -630,15 +651,15 @@ def creds.is_a? target
scope.must_be :nil?
"spanner-credentials"
}
stubbed_service = ->(project, credentials, timeout: nil, host: nil, client_config: nil, lib_name: nil, lib_version: nil) {
stubbed_service = ->(project, credentials, timeout: nil, host: nil, client_config: nil, **keyword_args) {
project.must_equal "project-id"
credentials.must_equal "spanner-credentials"
timeout.must_be :nil?
host.must_be :nil?
client_config.must_be :nil?
lib_name.must_equal custom_lib_name
lib_version.must_equal custom_lib_version
OpenStruct.new project: project, lib_name: lib_name, lib_version: lib_version
keyword_args[:lib_name].must_equal custom_lib_name
keyword_args[:lib_version].must_equal custom_lib_version
OpenStruct.new project: project, lib_name: keyword_args[:lib_name], lib_version: keyword_args[:lib_version]
}

# Clear all environment variables
Expand Down

0 comments on commit 7fb2800

Please sign in to comment.