Sha256: 13fc2c14f167511930f73f67e2b230dd4a5839726d5db893152008a9e7302447

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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_respond_to @resource_groups, method
    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

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/resources/test_resource_groups.rb
fog-azure-rm-0.1.0 test/models/resources/test_resource_groups.rb
fog-azure-rm-0.0.9 test/models/resources/test_resource_groups.rb