Sha256: 27c464194fbf402110c793466886dce571313c7c99249d3f10f13a9a5248802a
Contents?: true
Size: 1.64 KB
Versions: 7
Compression:
Stored size: 1.64 KB
Contents
require File.expand_path '../../test_helper', __dir__ # Test class for Check Managed Disk Exists Request class TestCheckManagedDiskExists < Minitest::Test def setup @service = Fog::Compute::AzureRM.new(credentials) @client = @service.instance_variable_get(:@compute_mgmt_client) @managed_disks = @client.disks end def test_check_managed_disk_exists_success mocked_response = ApiStub::Requests::Compute::ManagedDisk.get_managed_disk_response(@client) @managed_disks.stub :get, mocked_response do assert @service.check_managed_disk_exists('myrg1', 'mydisk1') end end def test_check_managed_disk_exists_failure response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) } @managed_disks.stub :get, response do assert !@service.check_managed_disk_exists('myrg1', 'mydisk1') end end def test_check_managed_disk_resource_group_exists_failure response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) } @managed_disks.stub :get, response do assert !@service.check_managed_disk_exists('myrg1', 'mydisk1') end end def test_check_managed_disk_exists_exception response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) } @managed_disks.stub :get, response do assert_raises(RuntimeError) { @service.check_managed_disk_exists('myrg1', 'mydisk1') } end end end
Version data entries
7 entries across 7 versions & 3 rubygems