Sha256: 03929c00bb7dae8369c281e6aa4fefa1b3009d8a97a327bf315b2ff19819e18a

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

require "spec_helper"

describe Fog::Brightbox::Compute, "#credentials" do
  describe "when 2FA support is disabled" do
    before do
      @options = {
        brightbox_client_id: "app-12345",
        brightbox_secret: "1234567890",
        brightbox_username: "jason.null@brightbox.com",
        brightbox_password: "HR4life",
        brightbox_one_time_password: "123456"
      }
      @service = Fog::Brightbox::Compute.new(@options)
    end

    it "does not add passed OTP to credentials" do
      assert_kind_of Fog::Brightbox::OAuth2::CredentialSet, @service.credentials
      assert_nil @service.credentials.one_time_password
    end
  end

  describe "with 2FA support is enabled" do
    before do
      @expected_otp = "123456"
      @options = {
        brightbox_client_id: "app-12345",
        brightbox_secret: "1234567890",
        brightbox_username: "jason.null@brightbox.com",
        brightbox_password: "HR4life",
        brightbox_support_two_factor: true,
        brightbox_one_time_password: @expected_otp
      }
      @service = Fog::Brightbox::Compute.new(@options)
    end

    it "adds passed OTP to credentials" do
      assert_kind_of Fog::Brightbox::OAuth2::CredentialSet, @service.credentials
      assert @expected_otp, @service.credentials.one_time_password
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fog-brightbox-1.12.0 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.11.0 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.10.0 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.9.1 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.9.0 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.8.2 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.8.1 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.8.0 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.7.3 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.7.2 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.7.1 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.7.0 spec/fog/brightbox/compute/credentials_spec.rb
fog-brightbox-1.6.0 spec/fog/brightbox/compute/credentials_spec.rb