fog 0.0.83 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'fog'
10
- s.version = '0.0.83'
11
- s.date = '2010-04-27'
10
+ s.version = '0.0.84'
11
+ s.date = '2010-04-28'
12
12
  s.rubyforge_project = 'fog'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
data/lib/fog.rb CHANGED
@@ -31,7 +31,7 @@ require 'fog/terremark'
31
31
 
32
32
  module Fog
33
33
 
34
- VERSION = '0.0.83'
34
+ VERSION = '0.0.84'
35
35
 
36
36
  module Mock
37
37
  @delay = 1
@@ -38,7 +38,7 @@ module Fog
38
38
  end
39
39
 
40
40
  def get(flavor_id)
41
- all.detect {|flavor| flavor.id = flavor_id}
41
+ all.detect {|flavor| flavor.id == flavor_id}
42
42
  end
43
43
 
44
44
  end
@@ -60,7 +60,7 @@ module Fog
60
60
 
61
61
  def new(attributes = {})
62
62
  if volume
63
- super({ :volume_id => volume.id }.merge!(attributes))
63
+ super({ 'volumeId' => volume.id }.merge!(attributes))
64
64
  else
65
65
  super
66
66
  end
@@ -43,6 +43,11 @@ module Fog
43
43
  class Mock
44
44
  include Fog::Terremark::Shared::Mock
45
45
  include Fog::Terremark::Shared::Parser
46
+
47
+ def initialize(option = {})
48
+ super
49
+ @data = self.class.data[:terremark_ecloud_username]
50
+ end
46
51
  end
47
52
 
48
53
  end
@@ -30,7 +30,16 @@ module Fog
30
30
  module Mock
31
31
 
32
32
  def get_organizations
33
- raise MockNotImplemented.new("Contributions welcome!")
33
+ response = Excon::Response.new
34
+ org_list = @data[:organizations].map do |organization|
35
+ { "name" => organization[:info][:name],
36
+ "href" => "https://services.enterprisecloud.terremark.com/api/v0.8a-ext2.0/org/#{organization[:info][:id]}",
37
+ "type" => "application/vnd.vmware.vcloud.org+xml"
38
+ }
39
+ end
40
+ response.body = { "OrgList" => org_list }
41
+ response.headers = Fog::Terremark::Shared::Mock.headers(response.body, "application/vnd.vmware.vcloud.orgList+xml")
42
+ response
34
43
  end
35
44
 
36
45
  end
@@ -51,21 +51,42 @@ module Fog
51
51
  end
52
52
 
53
53
  module Mock
54
- def self.data
55
- @data ||= Hash.new do |hash, key|
56
- hash[key] = {}
57
- end
58
- end
59
54
 
60
- def self.reset_data(keys=data.keys)
61
- for key in [*keys]
62
- data.delete(key)
63
- end
55
+ DATA = {
56
+ :organizations =>
57
+ [
58
+ {
59
+ :info => {
60
+ :name => "Boom Inc.",
61
+ :id => "1"
62
+ }
63
+ }
64
+ ]
65
+ }
66
+
67
+ def self.headers(body, content_type)
68
+ {"X-Powered-By"=>"ASP.NET",
69
+ "Date"=> Time.now.to_s,
70
+ "Content-Type"=> content_type,
71
+ "Content-Length"=> body.to_s.length,
72
+ "Server"=>"Microsoft-IIS/7.0",
73
+ "Set-Cookie"=>"vcloud-token=ecb37bfc-56f0-421d-97e5-bf2gdf789457; path=/",
74
+ "Cache-Control"=>"private"}
64
75
  end
65
76
 
66
77
  def initialize(options={})
67
- @terremark_username = options[:terremark_username]
68
- @data = self.class.data[@terremark_username]
78
+ self.class.instance_eval '
79
+ def self.data
80
+ @data ||= Hash.new do |hash, key|
81
+ hash[key] = Fog::Terremark::Shared::Mock::DATA
82
+ end
83
+ end'
84
+ self.class.instance_eval '
85
+ def self.reset_data(keys=data.keys)
86
+ for key in [*keys]
87
+ data.delete(key)
88
+ end
89
+ end'
69
90
  end
70
91
  end
71
92
 
@@ -89,6 +89,11 @@ module Fog
89
89
  class Mock
90
90
  include Fog::Terremark::Shared::Mock
91
91
  include Fog::Terremark::Shared::Parser
92
+
93
+ def initialize(option = {})
94
+ super
95
+ @data = self.class.data[:terremark_vcloud_username]
96
+ end
92
97
  end
93
98
 
94
99
  end
@@ -35,7 +35,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
35
35
  it "should return true if the snapshot is deleted" do
36
36
  volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
37
37
  snapshot = volume.snapshots.create
38
- snapshot.wait_for { status == "completed" }
38
+ snapshot.wait_for { ready? }
39
39
  snapshot.destroy.should be_true
40
40
  volume.destroy
41
41
  end
@@ -69,6 +69,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
69
69
 
70
70
  before(:each) do
71
71
  @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
72
+ @volume.wait_for { ready? }
72
73
  @snapshot = @volume.snapshots.new
73
74
  end
74
75
 
@@ -77,10 +78,9 @@ describe 'Fog::AWS::EC2::Snapshots' do
77
78
  end
78
79
 
79
80
  it "should return true when it succeeds" do
80
- eventually do
81
- @snapshot.save.should be_true
82
- @snapshot.destroy
83
- end
81
+ @snapshot.save.should be_true
82
+ @snapshot.wait_for { ready? }
83
+ @snapshot.destroy
84
84
  end
85
85
 
86
86
  it "should not exist in snapshots before save" do
@@ -90,6 +90,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
90
90
  it "should exist in snapshots after save" do
91
91
  @snapshot.save
92
92
  AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
93
+ @snapshot.wait_for { ready? }
93
94
  @snapshot.destroy
94
95
  end
95
96
 
@@ -19,8 +19,11 @@ describe 'Fog::AWS::EC2::Snapshots' do
19
19
  it "should limit snapshots by volume if present" do
20
20
  @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
21
21
  @other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
22
- eventually { @snapshot = @volume.snapshots.create }
22
+ @volume.wait_for { ready?}
23
+ @snapshot = @volume.snapshots.create
23
24
  @other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(@snapshot.id)
25
+
26
+ @snapshot.wait_for { ready? }
24
27
  @snapshot.destroy
25
28
  @other_volume.destroy
26
29
  @volume.destroy
@@ -32,10 +35,12 @@ describe 'Fog::AWS::EC2::Snapshots' do
32
35
 
33
36
  before(:each) do
34
37
  @volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
38
+ @volume.wait_for { ready? }
35
39
  @snapshot = @volume.snapshots.create
36
40
  end
37
41
 
38
42
  after(:each) do
43
+ @snapshot.wait_for { ready? }
39
44
  @snapshot.destroy
40
45
  @volume.destroy
41
46
  end
@@ -55,8 +60,9 @@ describe 'Fog::AWS::EC2::Snapshots' do
55
60
  it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
56
61
  volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
57
62
  snapshot = volume.snapshots.create
63
+ snapshot.wait_for { ready? }
58
64
  get = AWS[:ec2].snapshots.get(snapshot.id)
59
- snapshot.attributes.reject {|key, value| [:progress, :status].include?(key)}.should == get.attributes.reject {|key, value| [:progress, :status].include?(key)}
65
+ snapshot.attributes.should == get.attributes
60
66
  snapshot.destroy
61
67
  end
62
68
 
@@ -49,15 +49,15 @@ describe 'Fog::AWS::EC2::Volume' do
49
49
  before(:each) do
50
50
  @server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
51
51
  @volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
52
- @server.wait_for { state == 'running' }
52
+ @server.wait_for { ready? }
53
53
  end
54
54
 
55
55
  after(:each) do
56
56
  @server.destroy
57
57
  if @volume.id
58
- @volume.wait_for { status == 'attached' }
58
+ @volume.wait_for { state == 'attached' }
59
59
  @volume.server = nil
60
- @volume.wait_for { status == 'available' }
60
+ @volume.wait_for { ready? }
61
61
  @volume.destroy
62
62
  end
63
63
  end
@@ -40,8 +40,9 @@ describe 'Fog::AWS::EC2::Volumes' do
40
40
 
41
41
  it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
42
42
  volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
43
+ volume.wait_for { ready? }
43
44
  get = AWS[:ec2].volumes.get(volume.id)
44
- volume.attributes.reject { |key, value| [:device, :status].include?(key) }.should == get.attributes.reject { |key, value| [:device, :status].include?(key) }
45
+ volume.attributes.should == get.attributes
45
46
  volume.destroy
46
47
  end
47
48
 
@@ -32,7 +32,7 @@ describe 'Fog::AWS::S3::Directories' do
32
32
  end
33
33
 
34
34
  it "should return nil if no matching directory exists" do
35
- AWS[:s3].directories.get('fogdirectoryname').should be_nil
35
+ AWS[:s3].directories.get('fognotadirectory').should be_nil
36
36
  end
37
37
 
38
38
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 83
9
- version: 0.0.83
8
+ - 84
9
+ version: 0.0.84
10
10
  platform: ruby
11
11
  authors:
12
12
  - geemus (Wesley Beary)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-27 00:00:00 -07:00
17
+ date: 2010-04-28 00:00:00 -07:00
18
18
  default_executable: fog
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency