Sha256: 3d4abb09c178d63cf826247b42cfc543e1c105f386e73ac2d101690f407015a9

Contents?: true

Size: 1.26 KB

Versions: 37

Compression:

Stored size: 1.26 KB

Contents

require 'helper'

class SomeS3Consumer
  include S3
end

class S3Test < Vault::TestCase
  include LoggedDataHelper

  def setup
    super
    set_env 'APP_DEPLOY', 'test'
    set_env 'AWS_ACCESS_KEY_ID', 'fake access key id'
    set_env 'AWS_SECRET_ACCESS_KEY', 'fake secret access key'
    AWS.stub!
    @consumer = SomeS3Consumer.new
  end

  def log_output
    Scrolls.stream.string
  end

  # S3 writes should be logged.
  def test_write_logs
    @consumer.write('fake bucket', 'fake key', 'fake value')
    assert_match /fake key/, log_output
  end

  # S3 reads should be logged.
  def test_read_logs
    @consumer.read('fake bucket', 'fake key')
    assert_match /fake key/, log_output
  end

  # Should use S3 to write to bucket
  def test_writes_to_s3_bucket
    mock(@consumer).s3.mock!.buckets.
      mock!.[]('fake bucket').
      mock!.objects.
      mock!.[]('fake key').
      mock!.write('fake value')
    @consumer.write('fake bucket', 'fake key', 'fake value')
  end

  # Should use S3 to read from bucket
  def test_reads_from_s3_bucket
      #s3.buckets[bucket].objects[key].read
    mock(@consumer).s3.mock!.buckets.
      mock!.[]('fake bucket').
      mock!.objects.
      mock!.[]('fake key').
      mock!.read
    @consumer.read('fake bucket', 'fake key')
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
vault-tools-1.0.1 test/s3_test.rb
vault-tools-1.0.0 test/s3_test.rb
vault-tools-0.7.1 test/s3_test.rb
vault-tools-0.7.0 test/s3_test.rb
vault-tools-0.6.5 test/s3_test.rb
vault-tools-0.6.4 test/s3_test.rb
vault-tools-0.6.3 test/s3_test.rb
vault-tools-0.6.2 test/s3_test.rb
vault-tools-0.6.1 test/s3_test.rb
vault-tools-0.6.0 test/s3_test.rb
vault-tools-0.5.22 test/s3_test.rb
vault-tools-0.5.21 test/s3_test.rb
vault-tools-0.5.19 test/s3_test.rb
vault-tools-0.5.18 test/s3_test.rb
vault-tools-0.5.17 test/s3_test.rb
vault-tools-0.5.16 test/s3_test.rb
vault-tools-0.5.15 test/s3_test.rb
vault-tools-0.5.14 test/s3_test.rb
vault-tools-0.5.13 test/s3_test.rb
vault-tools-0.5.12 test/s3_test.rb