Sha256: d0d24f505f23e3a5d568f662ff589ff7e8af9868c7ca7af95f761fd5ad31cfd1

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 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)
    @rmc_client = @service.instance_variable_get(:@rmc)
    @resource_groups = Fog::Resources::AzureRM::ResourceGroups.new(service: @service)
    @response = ApiStub::Models::Resources::ResourceGroup.create_resource_group_response(@rmc_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
    response = [@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 :get_resource_group, @response do
      assert_instance_of Fog::Resources::AzureRM::ResourceGroup, @resource_groups.get('fog-test-rg')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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