Sha256: 47fde3e9e32cb8a27ce9ec94337767b9240d76beb40eded9c61aaff611e00ae9

Contents?: true

Size: 1.59 KB

Versions: 24

Compression:

Stored size: 1.59 KB

Contents

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

# Test class for Delete Resource Tag Request
class TestDeleteResourceTag < Minitest::Test
  def setup
    @service = Fog::Resources::AzureRM.new(credentials)
    @client = @service.instance_variable_get(:@rmc)
    @resources = @client.resources
    @resource_response = ApiStub::Requests::Resources::AzureResource.azure_resource_response(@client)
  end

  def test_delete_resource_tag_success
    @resources.stub :get, @resource_response do
      @resources.stub :create_or_update, @resource_response do
        resource_id = '/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}'
        assert @service.delete_resource_tag(resource_id, 'tag_name', 'tag_value')
      end
    end
  end

  def test_delete_resource_tag_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @resources.stub :get, @resource_response do
      @resources.stub :create_or_update, response do
        resource_id = '/subscriptions/########-####-####-####-############/resourceGroups/{RESOURCE-GROUP}/providers/Microsoft.Network/{PROVIDER-NAME}/{RESOURCE-NAME}'
        assert_raises(RuntimeError) { @service.delete_resource_tag(resource_id, 'tag_name', 'tag_value') }
      end
    end
  end

  def test_invalid_resource_id_exeception
    resource_id = 'Invalid-Resource-ID'
    assert_raises(RuntimeError) { @service.delete_resource_tag(resource_id, 'tag_name', 'tag_value') }
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.4 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-temp-0.0.3 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.3.3 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-temp-0.0.2 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-temp-0.0.1 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.3.2 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-downgraded-0.3.1 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.3.1 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-downgraded-0.3.0 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.3.0 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.7 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.6 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.5 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.4 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.3 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.2 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.1 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.2.0 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.1.2 test/requests/resources/test_delete_resource_tag.rb
fog-azure-rm-0.1.1 test/requests/resources/test_delete_resource_tag.rb