Sha256: b728c46fa3e7966b99c43f6d7277f725bc79cea4407d607207daeb4c492609b8

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require "integration/test_helper"

describe "Manage Blob Leases" do

  before do
    @container = Azure::Blobs.create_container(ContainerNameHelper.name)
    @blob = Azure::Blobs.create_block_blob(@container, "myBlob", nil)
  end

  after do
    ContainerNameHelper.clean
  end

  it "should be able to acquire a lease" do
    Azure::Blobs.lease(@blob, :acquire)
    @blob.error.must_be_nil
    @blob.lease_id.wont_be_nil
  end

  it "should fail trying to acquire a lease in a blob with an active lease" do
    Azure::Blobs.lease(@blob, :acquire)
    Azure::Blobs.lease(@blob, :acquire)
    @blob.error.wont_be_nil
  end

  it "should be able to renew a lease" do
    Azure::Blobs.lease(@blob, :acquire)
    Azure::Blobs.lease(@blob, :renew)
    @blob.error.must_be_nil
  end

  it "should be able to release a lease" do
    Azure::Blobs.lease(@blob, :acquire)
    Azure::Blobs.lease(@blob, :release)
    Azure::Blobs.lease(@blob, :acquire)
    @blob.error.must_be_nil
  end

  it "should be able to break a lease" do
    Azure::Blobs.lease(@blob, :acquire)
    Azure::Blobs.lease(@blob, :break)
    Azure::Blobs.lease(@blob, :acquire)
    @blob.error.wont_be_nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azure-0.1.1 test/integration/blobs/manage_blob_leases_test.rb
azure-0.1.0 test/integration/blobs/manage_blob_leases_test.rb