Sha256: aa42d95e76aa3b16dbd0f9cd1f22cce4ba91e5d29d95b258db5c5b4c116af4bb

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

Shindo.tests('Fog::Compute[:profitbricks] | location request', ['profitbricks', 'compute']) do

  @locations_schema = {
    'id'          => String,
    'type'        => String,
    'href'        => String,
    'items'       => Array
  }

  @location_schema = {
      'id'          => String,
      'type'        => String,
      'href'        => String,
      'properties'  => {
          'name'      => String,
          'features'  => Array
      }
  }

  service = Fog::Compute[:profitbricks]

  tests('success') do

    Excon.defaults[:connection_timeout] = 500

    tests('#get_all_locations').data_matches_schema(@locations_schema) do
      data = service.get_all_locations
      @location_id = data.body['items'][0]['id']

      data.body
    end

    tests('#get_location').data_matches_schema(@location_schema) do
      data = service.get_location(@location_id)
      data.body
    end

  end

  tests('failure') do
    tests('#get_location').raises(Fog::Errors::NotFound) do
      data = service.get_location('00000000-0000-0000-0000-000000000000')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 tests/profitbricks/requests/compute/location_tests.rb