Sha256: cbbc9fbbb186c37b91fb7245fc9002895d0810e280b587cc2366c286a903c164

Contents?: true

Size: 1.51 KB

Versions: 33

Compression:

Stored size: 1.51 KB

Contents

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

# Test Class for List Storage Accounts Request
class TestListStorageAccounts < Minitest::Test
  # This class posesses the test cases for the requests of storage account service.
  def setup
    @azure_credentials = Fog::Storage::AzureRM.new(credentials)
    @storage_mgmt_client = @azure_credentials.instance_variable_get(:@storage_mgmt_client)
    @storage_accounts = @storage_mgmt_client.storage_accounts
  end

  def test_list_storage_accounts_success
    response_body = ApiStub::Requests::Storage::StorageAccount.list_storage_accounts(@storage_mgmt_client)
    @storage_accounts.stub :list, response_body do
      assert @azure_credentials.list_storage_accounts.size >= 1
      @azure_credentials.list_storage_accounts.each do |s|
        assert_equal s.name, response_body.value[0].name
      end
    end
  end

  def test_list_storage_accounts_failure
    response_body = ApiStub::Requests::Storage::StorageAccount.list_storage_accounts(@storage_mgmt_client)
    @storage_accounts.stub :list, response_body do
      assert_raises ArgumentError do
        assert @azure_credentials.list_storage_accounts('wrong arg', 'second wrong arg')
      end
    end
  end

  def test_list_storage_accounts_exeception
    raise_exception = -> { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @storage_accounts.stub :list, raise_exception do
      assert_raises(RuntimeError) { @azure_credentials.list_storage_accounts }
    end
  end
end

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
fog-azure-rm-0.4.5 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-temp-0.0.5 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.4.4 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.4.3 test/requests/storage/test_list_storage_accounts.rb
far-gem-0.5.1 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.4.2 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.4.1 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.4.0 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.9 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.8 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.7 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.6 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.5 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.4 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-temp-0.0.4 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-temp-0.0.3 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.3 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-temp-0.0.2 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-temp-0.0.1 test/requests/storage/test_list_storage_accounts.rb
fog-azure-rm-0.3.2 test/requests/storage/test_list_storage_accounts.rb