Sha256: 072c44760c32c8204f3e6a7807cefa5e16c1cabb7a4a41587b5a0233845f5cbc

Contents?: true

Size: 1.63 KB

Versions: 23

Compression:

Stored size: 1.63 KB

Contents

require "helpers/integration_test_helper"

# TODO: this is a port over from legacy tests.  It shouldn't be scoped under Google, but under Google::Shared.
class TestAuthentication < FogIntegrationTest
  def setup
    @google_json_key_location = Fog.credentials[:google_json_key_location]
    @google_json_key_string = File.open(File.expand_path(@google_json_key_location), "rb", &:read)
  end

  def test_authenticates_with_json_key_location
    c = Fog::Compute::Google.new(:google_key_location => nil,
                                 :google_key_string => nil,
                                 :google_json_key_location => @google_json_key_location,
                                 :google_json_key_string => nil)
    assert_kind_of(Fog::Compute::Google::Real, c)
  end

  def test_authenticates_with_json_key_string
    c = Fog::Compute::Google.new(:google_key_location => nil,
                                 :google_key_string => nil,
                                 :google_json_key_location => nil,
                                 :google_json_key_string => @google_json_key_string)
    assert_kind_of(Fog::Compute::Google::Real, c)
  end

  def test_raises_argument_error_when_google_project_is_missing
    assert_raises(ArgumentError) { Fog::Compute::Google.new(:google_project => nil) }
  end

  def test_raises_argument_error_when_google_keys_are_given
    assert_raises(ArgumentError) do
      Fog::Compute::Google.new(:google_key_location => nil,
                               :google_key_string => nil,
                               :google_json_key_location => nil,
                               :google_json_key_string => nil)
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
fog-google-1.24.1 test/integration/test_authentication.rb
fog-google-1.24.0 test/integration/test_authentication.rb
fog-google-1.23.0 test/integration/test_authentication.rb
fog-google-1.22.0 test/integration/test_authentication.rb
fog-google-1.21.1 test/integration/test_authentication.rb
fog-google-1.21.0 test/integration/test_authentication.rb
fog-google-1.20.0 test/integration/test_authentication.rb
fog-google-1.19.0 test/integration/test_authentication.rb
fog-google-1.18.0 test/integration/test_authentication.rb
fog-google-1.17.0 test/integration/test_authentication.rb
fog-google-1.16.1 test/integration/test_authentication.rb
fog-google-1.16.0 test/integration/test_authentication.rb
fog-google-1.15.0 test/integration/test_authentication.rb
fog-google-1.14.0 test/integration/test_authentication.rb
gitlab-fog-google-1.14.0 test/integration/test_authentication.rb
fog-google-1.13.0 test/integration/test_authentication.rb
gitlab-fog-google-1.13.0 test/integration/test_authentication.rb
fog-google-1.12.1 test/integration/test_authentication.rb
fog-google-1.12.0 test/integration/test_authentication.rb
fog-google-1.11.0 test/integration/test_authentication.rb