Sha256: cb207c2ced08007853c9a841af47206a567537295fd7a6fb4e59e487c8940e14

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Heirloom do

    before do
      @config_mock = double('config')
      @logger_mock = double('logger')
      @config_mock.should_receive(:logger).and_return(@logger_mock)
      @authorizer = Heirloom::Authorizer.new :config => @config_mock,
                                             :name   => 'tim',
                                             :id     => '123'
    end

    it "should authorize access to an archive in all regions" do
      reader = double
      s3_acl = double
      @logger_mock.should_receive(:info).exactly(2).times
      @authorizer.should_receive(:reader).exactly(2).times.
                  and_return(reader)
      reader.should_receive(:get_bucket).exactly(2).times.
                      and_return('the-bucket')
      Heirloom::ACL::S3.should_receive(:new).exactly(2).
                        times.and_return(s3_acl)
      s3_acl.should_receive(:allow_read_access_from_accounts).
             exactly(2).times.
             with(:key_name   => '123',
                  :key_folder => 'tim',
                  :bucket     => 'the-bucket',
                  :accounts   => ["acct1", "acct2"])
      @authorizer.authorize :accounts => ['acct1', 'acct2'],
                            :regions  => ['us-west-1', 'us-west-2']
    end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
heirloom-0.5.0rc3 spec/archive/authorizer_spec.rb
heirloom-0.5.0rc2 spec/archive/authorizer_spec.rb
heirloom-0.5.0rc1 spec/archive/authorizer_spec.rb
heirloom-0.4.1rc1 spec/archive/authorizer_spec.rb
heirloom-0.4.0 spec/archive/authorizer_spec.rb
heirloom-0.3.1 spec/archive/authorizer_spec.rb
heirloom-0.3.0 spec/archive/authorizer_spec.rb
heirloom-0.3.0.rc1 spec/archive/authorizer_spec.rb