Sha256: 14929aec1bf21c71ec224640e7f1a5f72a941d3de8df4d0fb389def995c79ee5

Contents?: true

Size: 1.83 KB

Versions: 14

Compression:

Stored size: 1.83 KB

Contents

#
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
Shindo.tests("Fog::Account[:softlayer] | brand requests", ["softlayer"]) do
  @sl = Fog::Account[:softlayer]

  tests 'success' do
    attributes = {
      :keyName => "BRAND_NAME",
      :longName => "Your Long Brand Name",
      :name => "Brand Name",
      :account => {}
    }

    tests '#create_brand(attributes)' do
      response = @sl.create_brand(attributes)
      @brand_id = response.body[:id]
      data_matches_schema(201) { response.status }
      data_matches_schema(Softlayer::Account::Formats::Brand::BRAND) { response.body }
    end

    tests "#get_brand('@brand_id')" do
      response = @sl.get_brand(@brand_id)
      data_matches_schema(200) { response.status }
      data_matches_schema(Softlayer::Account::Formats::Brand::BRAND) { response.body }
    end

    tests "#get_brand_owned_accounts('@brand_id')" do
      response = @sl.get_brand_owned_accounts(@brand_id)
      data_matches_schema(200) { response.status }
      data_matches_schema(Array) { response.body }
    end
  end

  tests 'failure' do
    tests "#get_brand('99999999')" do
      response = @sl.get_brand(99999999)
      data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
      data_matches_schema(404){ response.status }
    end

    tests "#get_brand()" do
      raises(ArgumentError) { @sl.get_brand }
    end

    tests "#get_brand_owned_accounts('99999999')" do
      response = @sl.get_brand_owned_accounts(99999999)
      data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
      data_matches_schema(404){ response.status }
    end

    tests "#get_brand_owned_accounts()" do
      raises(ArgumentError) { @sl.get_brand_owned_accounts }
    end
  end
end

Version data entries

14 entries across 12 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/tests/softlayer/requests/account/brand_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/tests/softlayer/requests/account/brand_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.1.4 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.1.3 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.1.2 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.1.1 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.1.0 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.0.3 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.0.2 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.0.1 tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-1.0.0 tests/softlayer/requests/account/brand_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/tests/softlayer/requests/account/brand_tests.rb
fog-softlayer-0.4.7 tests/softlayer/requests/account/brand_tests.rb