Sha256: f74512708e8651becdf1cf82f13e3fd7eaa877ca556201d0254e9721b9a2aaf7

Contents?: true

Size: 1.56 KB

Versions: 24

Compression:

Stored size: 1.56 KB

Contents

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

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

  def test_check_storage_account_exists_success
    response_body = ApiStub::Requests::Storage::StorageAccount.storage_account_request(@storage_mgmt_client)
    response_body.provisioning_state = 'Succeeded'
    @storage_accounts.stub :get_properties, response_body do
      assert_equal @service.check_storage_account_exists('fog_test_rg', 'fog-test-storage-account'), true
    end
  end

  def test_check_storage_account_exists_failure
    response = ApiStub::Requests::Storage::StorageAccount.storage_account_request(@storage_mgmt_client)
    response.provisioning_state = 'Failed'
    @storage_accounts.stub :get_properties, response do
      assert !@service.check_storage_account_exists('fog_test_rg', 'fogtestsasecond')
    end
  end

  def test_check_storage_account_exists_exception
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) }
    @storage_accounts.stub :get_properties, response do
      assert_raises(RuntimeError) { @service.check_storage_account_exists('fog_test_rg', 'fogtestsasecond') }
    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

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