Parent

Included Modules

Class/Module Index [+]

Quicksearch

RackspaceTest::BucketsTest

Public Instance Methods

app() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 9
def app
  Sinatra::Application
end
test_01_it_can_create_new_bucket() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 17
def test_01_it_can_create_new_bucket
  params = {
    :name => @@created_bucket_name,
    :'api[driver]' => 'rackspace'
  }
  post_url '/api/buckets', params
  last_response.status.should == 201 # Created
  bucket = last_xml_response
  check_bucket_basics(bucket)
  (bucket/'bucket/size').first.text.should == "0"
end
test_02_it_can_post_new_blob() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 29
def test_02_it_can_post_new_blob
  temp_file=File.open(@@created_blob_local_file)
  params = {
    'blob_id' => @@created_blob_name,
    :meta_params=>"2",
    :meta_name1=>"Author",
    :meta_value1=>"deltacloud",
    :meta_name2=>"foo",
    :meta_value2=>"bar",
    :'api[driver]' => 'rackspace'
  }
  uri="/api/buckets/#{@@created_bucket_name}"
  vcr_cassette = "post-"+Digest::SHA1.hexdigest("#{uri}-#{params.sort_by {|k,v| k.to_s}}")
  params.merge!({'blob_data' => Rack::Test::UploadedFile.new(temp_file.path, "text/html")})
  post_url uri, params, {'vcr_cassette'=>vcr_cassette}
  last_response.status.should == 200
  blob= last_xml_response
  check_blob_basics(blob)
end
test_03_it_can_retrieve_named_bucket_details() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 49
def test_03_it_can_retrieve_named_bucket_details
   params = {
    :'api[driver]' => 'rackspace'
  }
  get_url "/api/buckets/#{@@created_bucket_name}", params
  last_response.status.should == 200
  bucket = last_xml_response
  check_bucket_basics(bucket)
  (bucket/'bucket/size').first.text.should == "1" #assuming blob created succesfully right?
end
test_04_it_can_retrieve_named_blob_details() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 60
def test_04_it_can_retrieve_named_blob_details
  params = {
            :'api[driver]' => 'rackspace'
           }
  get_url "/api/buckets/#{@@created_bucket_name}/#{@@created_blob_name}", params
  last_response.status.should == 200
  blob = last_xml_response
  check_blob_basics(blob)
  check_blob_metadata(blob, {"author"=>"deltacloud", "foo"=>"bar"})
end
test_06_it_can_update_blob_metadata() click to toggle source

end

# File tests/drivers/rackspace/buckets_test.rb, line 84
def test_06_it_can_update_blob_metadata
  params = {
            :'api[driver]' => 'rackspace'
           }
  new_meta = {"X-Deltacloud-Blobmeta-author" => "ApacheDeltacloud", "X-Deltacloud-Blobmeta-oof" => "rab"}
  new_meta.each_pair do |k,v|
    header k, v
  end
  post_url "/api/buckets/#{@@created_bucket_name}/#{@@created_blob_name}", params
  last_response.status.should == 204
  new_meta.each_pair do |k,v|
    (last_response.headers[k]==v).should == true
  end
end
test_07_it_can_delete_blob() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 99
def test_07_it_can_delete_blob
  params = {
            :'api[driver]' => 'rackspace'
           }
  delete_url "/api/buckets/#{@@created_bucket_name}/#{@@created_blob_name}", params
  last_response.status.should == 204
end
test_08_it_can_delete_bucket() click to toggle source
# File tests/drivers/rackspace/buckets_test.rb, line 107
def test_08_it_can_delete_bucket
  params = {
            :'api[driver]' => 'rackspace'
           }
  delete_url "/api/buckets/#{@@created_bucket_name}", params
  last_response.status.should == 204
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.