Sha256: 7296a39f6283cb10c10b48dffef60198e226ee7ebaa7d2c392bb66f7d8126814

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for Resource Groups Collection
class TestResourceGroups < Minitest::Test
  def setup
    @service = Fog::Resources::AzureRM.new(credentials)
    client = @service.instance_variable_get(:@rmc)
    @resource_groups = Fog::Resources::AzureRM::ResourceGroups.new(service: @service)
    @response = [ApiStub::Models::Resources::ResourceGroup.create_resource_group_response(client)]
  end

  def test_collection_methods
    methods = [
      :all,
      :get
    ]
    methods.each do |method|
      assert @resource_groups.respond_to? method, true
    end
  end

  def test_all_method_response
    @service.stub :list_resource_groups, @response do
      assert_instance_of Fog::Resources::AzureRM::ResourceGroups, @resource_groups.all
      assert @resource_groups.all.size >= 1
      @resource_groups.all.each do |s|
        assert_instance_of Fog::Resources::AzureRM::ResourceGroup, s
      end
    end
  end

  def test_get_method_response
    @service.stub :list_resource_groups, @response do
      assert_instance_of Fog::Resources::AzureRM::ResourceGroup, @resource_groups.get('fog-test-rg')
      assert @resource_groups.get('wrong-name').nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.5 test/models/resources/test_resource_groups.rb