Sha256: e9b22833d9f3dd40a78f9794d0552aad02f4064a7452d6e6e73d8672bc2be582

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'test/test_helper'
require 'fileutils'
require 'fakes3/server'

# You need to have s3cmd installed to use this
class S3CmdTest < Test::Unit::TestCase

  def setup
    config = File.expand_path(File.join(File.dirname(__FILE__),'local_s3_cfg'))
    @s3cmd = "s3cmd --config #{config}"
  end

  def teardown
  end

  def test_create_bucket
    `#{@s3cmd} mb s3://s3cmd_bucket`
    output = `#{@s3cmd} ls`
    assert_match(/s3cmd_bucket/,output)
  end

  def test_store
    File.open(__FILE__,'rb') do |input|
      File.open("/tmp/fakes3_upload",'wb') do |output|
        output << input.read
      end
    end
    output = `#{@s3cmd} put /tmp/fakes3_upload s3://s3cmd_bucket/upload`
    assert_match(/stored/,output)

    FileUtils.rm("/tmp/fakes3_upload")
  end

  def test_acl
    File.open(__FILE__,'rb') do |input|
      File.open("/tmp/fakes3_acl_upload",'wb') do |output|
        output << input.read
      end
    end
    output = `#{@s3cmd} put /tmp/fakes3_acl_upload s3://s3cmd_bucket/acl_upload`
    assert_match(/stored/,output)

    output = `#{@s3cmd} --force setacl -P s3://s3cmd_bucket/acl_upload`
  end

  def test_large_store
  end

  def test_multi_directory
  end

  def test_intra_bucket_copy
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fakes3-0.1.1 test/s3cmd_test.rb
fakes3-0.1.0 test/s3cmd_test.rb