Sha256: 00657e37e0024d3874ce78c0d2e309384670bd579f892cd123ad6d86e20a76db

Contents?: true

Size: 1.46 KB

Versions: 14

Compression:

Stored size: 1.46 KB

Contents

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

# Test Class for Create Storage Account Request
class TestCreateStorageAccount < 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
    @storage_account_arguments = ApiStub::Requests::Storage::StorageAccount.storage_account_arguments
    @storage_acc_obj = ApiStub::Requests::Storage::StorageAccount.storage_account_request(@storage_mgmt_client)
  end

  def test_create_storage_account_success
    @storage_accounts.stub :create, @storage_acc_obj do
      assert_equal @azure_credentials.create_storage_account(@storage_account_arguments), @storage_acc_obj
    end
  end

  def test_create_storage_account_failure
    @storage_accounts.stub :create, @storage_acc_obj do
      assert_raises ArgumentError do
        @azure_credentials.create_storage_account
      end
    end
  end

  def test_create_storage_account_exception
    raise_exception = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @storage_accounts.stub :create, raise_exception do
      assert_raises(MsRestAzure::AzureOperationError) { @azure_credentials.create_storage_account(@storage_account_arguments) }
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
fog-azure-rm-0.6.0 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.5.3 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.5.2 test/requests/storage/test_create_storage_account.rb
far-gem-0.5.6 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.5.1 test/requests/storage/test_create_storage_account.rb
far-gem-0.5.5 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.5.0 test/requests/storage/test_create_storage_account.rb
far-gem-0.5.4 test/requests/storage/test_create_storage_account.rb
far-gem-0.5.3 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.4.9 test/requests/storage/test_create_storage_account.rb
far-gem-0.5.2 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.4.8 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.4.7 test/requests/storage/test_create_storage_account.rb
fog-azure-rm-0.4.6 test/requests/storage/test_create_storage_account.rb