Sha256: 37ff0756918a596ff98d0d4e95955f3b5447fede974d33aee60ae69255994129

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'test/test_helper'
require 'fileutils'
require 'shuck/server'
require 'right_aws'

class RightAWSCommandsTest < Test::Unit::TestCase

  def setup
    @s3 = RightAws::S3Interface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX', {:multi_thread => false, :logger => Logger.new('/tmp/x.log'), :server => 'localhost', :port => 10453, :protocol => 'http' })
  end

  def teardown
  end

  def test_create_bucket
    bucket = @s3.create_bucket("s3media")
    assert_not_nil bucket
  end

  def test_store
    @s3.put("s3media","helloworld","Hello World Man!")
    obj = @s3.get("s3media","helloworld")
    assert_equal "Hello World Man!",obj[:object]

    obj = @s3.get("s3media","helloworld", )
  end

  def test_large_store
    @s3.put("s3media","helloworld","Hello World Man!")
    buffer = ""
    500000.times do
      buffer << "#{(rand * 100).to_i}"
    end
#
    buf_len = buffer.length
    @s3.put("s3media","big",buffer)

    output = ""
    @s3.get("s3media","big") do |chunk|
      output << chunk
    end
    assert_equal buf_len,output.size
  end

  def test_multi_directory
    @s3.put("s3media","dir/right/123.txt","recursive")
    output = ""
    obj = @s3.get("s3media","dir/right/123.txt") do |chunk|
      output << chunk
    end
    assert_equal "recursive", output
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shuck-0.0.4 test/right_aws_commands_test.rb