Sha256: 32988e21a94eb109f49ec8bc782426fa634d158e24d97dea5099eade8bf394b9

Contents?: true

Size: 869 Bytes

Versions: 2

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

class BackupsResourceTest < Minitest::Test
  def test_list
    stub = stub_request("backups", response: stub_response(fixture: "backups/list"))
    client = Vultr::Client.new(api_key: "fake", adapter: :test, stubs: stub)
    backups = client.backups.list
    assert_equal Vultr::Collection, backups.class
    assert_equal Vultr::Backup, backups.data.first.class
    assert_equal 1, backups.total
  end

  def test_retrieve
    backup_id = "cb676a46-66fd-4dfb-b839-443f2e6c0b60"
    stub = stub_request("backups/#{backup_id}", response: stub_response(fixture: "backups/retrieve"))
    client = Vultr::Client.new(api_key: "fake", adapter: :test, stubs: stub)
    backup = client.backups.retrieve(backup_id: backup_id)

    assert_equal Vultr::Backup, backup.class
    assert_equal "complete", backup.status
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vultr-2.0.0 test/vultr/resources/backups_test.rb
vultr-1.0.0 test/vultr/resources/backups_test.rb