Sha256: f4c44c5fc6c89afd603003d41dffbdeaeef5b9636c42911b6f9e3b07a1c62242

Contents?: true

Size: 939 Bytes

Versions: 6

Compression:

Stored size: 939 Bytes

Contents

require 'test/test_helper'

class VultrRegionTest < Minitest::Test

  def setup
    Vultr.api_key = ENV['VULTR_API_KEY']
  end

  def test_region_list_url
    region_list_url = 'https://api.vultr.com/v1/regions/list'
    assert_equal region_list_url, Vultr::Region._list
  end

  def test_region_availability_url
    region_list_url = 'https://api.vultr.com/v1/regions/availability?DCID=1'
    assert_equal region_list_url, Vultr::Region._availability(DCID: 1)
  end

  def test_region_responses
    r = Vultr::Region.list

    assert r.has_key? :status
    assert_equal r[:status], 200

    assert r.has_key? :result
    assert_instance_of Hash, r[:result]

    k, v = r[:result].first
    dc_id = k.to_i

    r = Vultr::Region.availability(DCID: dc_id)

    assert r.has_key? :status
    assert_equal r[:status], 200

    assert r.has_key? :result
    assert_instance_of Array, r[:result]
  end

  def teardown
    # Do nothing
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vultr-0.3.5 test/vultr/vultr_region_test.rb
vultr-0.3.4 test/vultr/vultr_region_test.rb
vultr-0.3.3 test/vultr/vultr_region_test.rb
vultr-0.3.2 test/vultr/vultr_region_test.rb
vultr-0.3.1 test/vultr/vultr_region_test.rb
vultr-0.2.1 test/vultr/vultr_region_test.rb