Sha256: b2140a58bc5d6797c80d83f3f392cd9cfe8411c0df998e3bcba7a96370cbeec8

Contents?: true

Size: 1.28 KB

Versions: 53

Compression:

Stored size: 1.28 KB

Contents

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

# Test class for Remove Security Rule
class TestRemoveSecurityRule < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @client = @service.instance_variable_get(:@network_client)
    @network_security_groups = @client.network_security_groups
  end

  def test_remove_security_rule_success
    mocked_response = ApiStub::Requests::Network::NetworkSecurityGroup.add_security_rules_response(@client)
    expected_response_json = ApiStub::Requests::Network::NetworkSecurityGroup.create_network_security_group_response(@client)
    @network_security_groups.stub :get, mocked_response do
      @network_security_groups.stub :begin_create_or_update, expected_response_json do
        assert_equal @service.remove_security_rule('fog-test-rg', 'fog-test-nsg', 'testRule'), expected_response_json
      end
    end
  end

  def test_remove_security_rule_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @network_security_groups.stub :get, response do
      assert_raises MsRestAzure::AzureOperationError do
        @service.remove_security_rule('fog-test-rg', 'fog-test-nsg', 'testRule')
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 4 rubygems

Version Path
fog-azure-rm-0.4.1 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.4.0 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.9 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.8 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.7 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.6 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.5 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.4 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-temp-0.0.4 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-temp-0.0.3 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.3 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-temp-0.0.2 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-temp-0.0.1 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.2 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-downgraded-0.3.1 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.1 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-downgraded-0.3.0 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.3.0 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.2.7 test/requests/network/test_remove_security_rule.rb
fog-azure-rm-0.2.6 test/requests/network/test_remove_security_rule.rb