Make the scope optional
This commit is contained in:
1 parent
7a9dea37f1
commit
bd97c23d9f
7 files changed
+31
-19
No files matched your search
@@ -104,6 +104,18 @@ describe '#get_application_default' do
|
||||
end
|
||||
end
|
||||
|
||||
it 'succeeds with default file without a scope' do
|
||||
ENV.delete(@var_name) unless ENV[@var_name].nil?
|
||||
Dir.mktmpdir do |dir|
|
||||
key_path = File.join(dir, '.config',
|
||||
CredentialsLoader::WELL_KNOWN_PATH)
|
||||
FileUtils.mkdir_p(File.dirname(key_path))
|
||||
File.write(key_path, cred_json_text)
|
||||
ENV['HOME'] = dir
|
||||
expect(Google::Auth.get_application_default).to_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
it 'succeeds without default file or env if on compute engine' do
|
||||
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
||||
stub.get('/') do |_env|
|
||||
|
||||
@@ -47,8 +47,8 @@ describe Google::Auth::ServiceAccountCredentials do
|
||||
before(:example) do
|
||||
@key = OpenSSL::PKey::RSA.new(2048)
|
||||
@client = ServiceAccountCredentials.new(
|
||||
'https://www.googleapis.com/auth/userinfo.profile',
|
||||
StringIO.new(cred_json_text))
|
||||
StringIO.new(cred_json_text),
|
||||
'https://www.googleapis.com/auth/userinfo.profile')
|
||||
end
|
||||
|
||||
def make_auth_stubs(opts = {})
|
||||
|
||||
@@ -47,8 +47,8 @@ describe Google::Auth::UserRefreshCredentials do
|
||||
before(:example) do
|
||||
@key = OpenSSL::PKey::RSA.new(2048)
|
||||
@client = UserRefreshCredentials.new(
|
||||
'https://www.googleapis.com/auth/userinfo.profile',
|
||||
StringIO.new(cred_json_text))
|
||||
StringIO.new(cred_json_text),
|
||||
'https://www.googleapis.com/auth/userinfo.profile')
|
||||
end
|
||||
|
||||
def make_auth_stubs(opts = {})
|
||||
|
||||
Reference in new issue
Block a user