Sha256: 070fdd3f19f8854b450c430e0cd761ce405517d73fc2fa30f3ddbc05846ea5d6

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

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

# Test class for Get Backup Job for VM request
class TestGetBackupJobForVM < Minitest::Test
  def setup
    @service = Fog::Storage::AzureRM.new(credentials)
    @token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
  end

  def test_get_backup_job_for_vm_success
    backup_jobs_response = ApiStub::Requests::Storage::RecoveryVault.get_all_backup_jobs_response
    single_backup_job_response = JSON.parse(backup_jobs_response)['value'][0]
    @service.stub :get_all_backup_jobs, JSON.parse(backup_jobs_response)['value'] do
      assert_equal @service.get_backup_job_for_vm('fog-test-vault', 'fog-test-vault', 'fog-test-vm', 'fog-test-vm-rg', 'Backup'), single_backup_job_response
    end
  end

  def test_get_backup_job_for_vm_argument_error
    backup_jobs_response = ApiStub::Requests::Storage::RecoveryVault.get_all_backup_jobs_response
    @service.stub :get_all_backup_jobs, JSON.parse(backup_jobs_response)['value'] do
      assert_raises ArgumentError do
        @service.get_backup_job_for_vm('fog-test-vault', 'fog-test-vault', 'fog-test-vm')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/requests/storage/test_get_backup_job_for_vm.rb
fog-azure-rm-0.1.0 test/requests/storage/test_get_backup_job_for_vm.rb