Sha256: e1f108e1cae8469b854eb3885b5a1bc5232872d60139ece459ca3712a6d86fca

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

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

# Test class for List Resource Groups Request
class TestListResourceGroups < Minitest::Test
  def setup
    @service = Fog::Resources::AzureRM.new(credentials)
    @client = @service.instance_variable_get(:@rmc)
    @resource_groups = @client.resource_groups
  end

  def test_list_resource_group_success
    mocked_response = ApiStub::Requests::Resources::ResourceGroup.list_resource_group_response(@client)
    @resource_groups.stub :list_as_lazy, mocked_response do
      assert_equal @service.list_resource_groups, mocked_response.value
    end
  end

  def test_list_resource_group_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @resource_groups.stub :list_as_lazy, response do
      assert_raises(Fog::AzureRm::OperationError) { @service.list_resource_groups }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.5 test/requests/resources/test_list_resource_groups.rb