Sha256: bf9257c46df5fbe539817585aba4cc0f74280b5641119a0d86158d0e9e5ad120

Contents?: true

Size: 1.44 KB

Versions: 33

Compression:

Stored size: 1.44 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_update_storage_account_success
    @storage_accounts.stub :update, @storage_acc_obj do
      assert_equal @azure_credentials.update_storage_account(@storage_account_arguments), @storage_acc_obj
    end
  end

  def test_update_storage_account_failure
    @storage_accounts.stub :update, @storage_acc_obj do
      assert_raises ArgumentError do
        @azure_credentials.update_storage_account
      end
    end
  end

  def test_update_storage_account_exception
    raise_exception = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @storage_accounts.stub :update, raise_exception do
      assert_raises(RuntimeError) { @azure_credentials.update_storage_account(@storage_account_arguments) }
    end
  end
end

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
fog-azure-rm-downgraded-0.3.1 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.3.1 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-downgraded-0.3.0 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.3.0 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.7 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.6 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.5 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.4 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.3 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.2 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.1 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.2.0 test/requests/storage/test_update_storage_account.rb
fog-azure-rm-0.1.2 test/requests/storage/test_update_storage_account.rb