amazon-ec2 0.2.5 → 0.2.6

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.
@@ -11,31 +11,31 @@
11
11
  require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "An EC2 instance " do
14
-
14
+
15
15
  setup do
16
16
  @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
-
17
+
18
18
  @confirm_product_instance_response_body = <<-RESPONSE
19
19
  <ConfirmProductInstanceResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
20
20
  <result>true</result>
21
21
  <ownerId>254933287430</ownerId>
22
22
  </ConfirmProductInstanceResponse>
23
23
  RESPONSE
24
-
24
+
25
25
  end
26
-
27
-
26
+
27
+
28
28
  specify "should indicate whether a product code is attached to an instance" do
29
29
  @ec2.stubs(:make_request).with('ConfirmProductInstance', {"ProductCode"=>"774F4FF8", "InstanceId"=>"i-10a64379"}).
30
30
  returns stub(:body => @confirm_product_instance_response_body, :is_a? => true)
31
-
31
+
32
32
  @ec2.confirm_product_instance( :product_code => "774F4FF8", :instance_id => "i-10a64379" ).should.be.an.instance_of EC2::Response
33
33
  response = @ec2.confirm_product_instance( :product_code => "774F4FF8", :instance_id => "i-10a64379" )
34
34
  response.ownerId.should.equal "254933287430"
35
35
  response.result.should.equal "true"
36
36
  end
37
-
38
-
37
+
38
+
39
39
  specify "method get_console_output should raise an exception when called without nil/empty string arguments" do
40
40
  lambda { @ec2.confirm_product_instance() }.should.raise(EC2::ArgumentError)
41
41
  lambda { @ec2.confirm_product_instance(:product_code => "774F4FF8", :instance_id => nil) }.should.raise(EC2::ArgumentError)
@@ -43,6 +43,6 @@ context "An EC2 instance " do
43
43
  lambda { @ec2.confirm_product_instance(:product_code => nil, :instance_id => "i-10a64379") }.should.raise(EC2::ArgumentError)
44
44
  lambda { @ec2.confirm_product_instance(:product_code => "", :instance_id => "i-10a64379") }.should.raise(EC2::ArgumentError)
45
45
  end
46
-
47
-
46
+
47
+
48
48
  end
@@ -11,78 +11,78 @@
11
11
  require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "The Response classes " do
14
-
15
-
14
+
15
+
16
16
  setup do
17
17
  @http_xml = <<-RESPONSE
18
18
  <RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
19
19
  <return>true</return>
20
20
  </RebootInstancesResponse>
21
21
  RESPONSE
22
-
22
+
23
23
  @response = EC2::Response.parse(:xml => @http_xml)
24
-
24
+
25
25
  # test out adding arbitrary new values to the OpenStruct
26
26
  @response.name = "foo"
27
27
  @response.number = '123'
28
28
  end
29
-
30
-
29
+
30
+
31
31
  specify "should properly run the to_string(short) method for the short version" do
32
- # sample response looks like: "#<EC2::Response:0x100A45F2E ...>". Our response should look
33
- # exactly the same, except it should have different hex digits in the middle (after 0x)
32
+ # sample response looks like: "#<EC2::Response:0x100A45F2E ...>". Our response should look
33
+ # exactly the same, except it should have different hex digits in the middle (after 0x)
34
34
  # that are nine chars long.
35
35
  @response.to_string(true).should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} ...>/
36
36
  end
37
-
38
-
37
+
38
+
39
39
  specify "should properly run the to_string(false) method for the long version" do
40
40
  @response.to_string(false).should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} name=\"foo\" number=\"123\" parent=nil return=\"true\"/
41
41
  end
42
-
43
-
42
+
43
+
44
44
  specify "should properly run the to_string(false) method for the long version when called with no params" do
45
45
  @response.to_string.should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} name=\"foo\" number=\"123\" parent=nil return=\"true\"/
46
46
  end
47
-
48
-
47
+
48
+
49
49
  specify "should provide the same results from to_s as from to_string(false) " do
50
50
  @response.to_s.should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} name=\"foo\" number=\"123\" parent=nil return=\"true\"/
51
51
  end
52
-
53
-
52
+
53
+
54
54
  specify "should be a kind of type OpenStruct" do
55
55
  @response.kind_of?(OpenStruct).should.equal true
56
56
  @response.kind_of?(Enumerable).should.equal true
57
57
  end
58
-
59
-
58
+
59
+
60
60
  specify "should return its members" do
61
61
  @response.members.length.should.equal 6
62
62
  test_array = ["return", "xmlns", "number", "name", "parent", "xml"].sort
63
63
  @response.members.sort.should.equal test_array
64
64
  end
65
-
66
-
65
+
66
+
67
67
  specify "should properly respond to its 'each' method" do
68
68
  answer = @response.each do |f| f ; end
69
69
  answer.name.should.equal "foo"
70
70
  answer.number.should.equal '123'
71
71
  end
72
-
73
-
72
+
73
+
74
74
  specify "should respond to the '[]' method" do
75
75
  @response[:name].should.equal "foo"
76
76
  end
77
-
78
-
77
+
78
+
79
79
  specify "should respond correctly to the '[]=' method and set a variable" do
80
80
  @response[:name].should.equal "foo"
81
81
  @response[:name]="bar"
82
82
  @response[:name].should.equal "bar"
83
83
  end
84
-
85
-
84
+
85
+
86
86
  specify "should respond correctly to the 'each_pair' method" do
87
87
  @response.each_pair {|k,v|
88
88
  case k
@@ -93,10 +93,10 @@ context "The Response classes " do
93
93
  end
94
94
  }
95
95
  end
96
-
96
+
97
97
  specify "should return the original amazon XML response in the 'xml' attribute of the response object." do
98
98
  @response.xml.should.equal @http_xml
99
99
  end
100
-
101
-
100
+
101
+
102
102
  end
@@ -11,22 +11,22 @@
11
11
  require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "EC2 security groups " do
14
-
14
+
15
15
  setup do
16
16
  @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
-
17
+
18
18
  @create_security_group_response_body = <<-RESPONSE
19
- <CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
20
- <return>true</return>
19
+ <CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
20
+ <return>true</return>
21
21
  </CreateSecurityGroupResponse>
22
22
  RESPONSE
23
-
23
+
24
24
  @delete_security_group_response_body = <<-RESPONSE
25
- <DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
26
- <return>true</return>
25
+ <DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2007-03-01">
26
+ <return>true</return>
27
27
  </DeleteSecurityGroupResponse>
28
28
  RESPONSE
29
-
29
+
30
30
  @describe_security_groups_response_body = <<-RESPONSE
31
31
  <DescribeSecurityGroupsResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
32
32
  <securityGroupInfo>
@@ -65,73 +65,73 @@ context "EC2 security groups " do
65
65
  </securityGroupInfo>
66
66
  </DescribeSecurityGroupsResponse>
67
67
  RESPONSE
68
-
68
+
69
69
  @authorize_security_group_ingress_response_body = <<-RESPONSE
70
70
  <AuthorizeSecurityGroupIngressResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
71
71
  <return>true</return>
72
72
  </AuthorizeSecurityGroupIngressResponse>
73
73
  RESPONSE
74
-
74
+
75
75
  @revoke_security_group_ingress_response_body = <<-RESPONSE
76
76
  <RevokeSecurityGroupIngressResponse xm-lns="http://ec2.amazonaws.com/doc/2007-03-01">
77
77
  <return>true</return>
78
78
  </RevokeSecurityGroupIngressResponse>
79
79
  RESPONSE
80
-
80
+
81
81
  end
82
-
83
-
82
+
83
+
84
84
  specify "should be able to be created" do
85
85
  @ec2.stubs(:make_request).with('CreateSecurityGroup', {"GroupName"=>"WebServers", "GroupDescription"=>"Web"}).
86
86
  returns stub(:body => @create_security_group_response_body, :is_a? => true)
87
87
  @ec2.create_security_group( :group_name => "WebServers", :group_description => "Web" ).should.be.an.instance_of EC2::Response
88
88
  end
89
-
90
-
89
+
90
+
91
91
  specify "method create_security_group should reject bad arguments" do
92
92
  @ec2.stubs(:make_request).with('CreateSecurityGroup', {"GroupName"=>"WebServers", "GroupDescription"=>"Web"}).
93
93
  returns stub(:body => @create_security_group_response_body, :is_a? => true)
94
-
94
+
95
95
  lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "Web" ) }.should.not.raise(EC2::ArgumentError)
96
96
  lambda { @ec2.create_security_group() }.should.raise(EC2::ArgumentError)
97
-
97
+
98
98
  # :group_name can't be nil or empty
99
99
  lambda { @ec2.create_security_group( :group_name => "", :group_description => "Web" ) }.should.raise(EC2::ArgumentError)
100
100
  lambda { @ec2.create_security_group( :group_name => nil, :group_description => "Web" ) }.should.raise(EC2::ArgumentError)
101
-
101
+
102
102
  # :group_description can't be nil or empty
103
103
  lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "" ) }.should.raise(EC2::ArgumentError)
104
104
  lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => nil ) }.should.raise(EC2::ArgumentError)
105
105
  end
106
-
107
-
106
+
107
+
108
108
  specify "should be able to be deleted" do
109
109
  @ec2.stubs(:make_request).with('DeleteSecurityGroup', {"GroupName"=>"WebServers"}).
110
110
  returns stub(:body => @delete_security_group_response_body, :is_a? => true)
111
111
  @ec2.delete_security_group( :group_name => "WebServers" ).should.be.an.instance_of EC2::Response
112
112
  end
113
-
114
-
113
+
114
+
115
115
  specify "method delete_security_group should reject bad arguments" do
116
116
  @ec2.stubs(:make_request).with('DeleteSecurityGroup', {"GroupName"=>"WebServers"}).
117
117
  returns stub(:body => @delete_security_group_response_body, :is_a? => true)
118
-
118
+
119
119
  lambda { @ec2.delete_security_group( :group_name => "WebServers" ) }.should.not.raise(EC2::ArgumentError)
120
120
  lambda { @ec2.delete_security_group() }.should.raise(EC2::ArgumentError)
121
-
121
+
122
122
  # :group_name can't be nil or empty
123
123
  lambda { @ec2.delete_security_group( :group_name => "" ) }.should.raise(EC2::ArgumentError)
124
124
  lambda { @ec2.delete_security_group( :group_name => nil ) }.should.raise(EC2::ArgumentError)
125
125
  end
126
-
127
-
126
+
127
+
128
128
  specify "should be able to be described with describe_security_groups" do
129
129
  @ec2.stubs(:make_request).with('DescribeSecurityGroups', { "GroupName.1" => "WebServers", "GroupName.2" => "RangedPortsBySource" }).
130
130
  returns stub(:body => @describe_security_groups_response_body, :is_a? => true)
131
131
  @ec2.describe_security_groups( :group_name => ["WebServers", "RangedPortsBySource"] ).should.be.an.instance_of EC2::Response
132
-
132
+
133
133
  response = @ec2.describe_security_groups( :group_name => ["WebServers", "RangedPortsBySource"] )
134
-
134
+
135
135
  response.securityGroupInfo.item[0].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
136
136
  response.securityGroupInfo.item[0].groupName.should.equal "WebServers"
137
137
  response.securityGroupInfo.item[0].groupDescription.should.equal "Web"
@@ -140,7 +140,7 @@ context "EC2 security groups " do
140
140
  response.securityGroupInfo.item[0].ipPermissions.item[0].toPort.should.equal "80"
141
141
  response.securityGroupInfo.item[0].ipPermissions.item[0].groups.should.be.nil
142
142
  response.securityGroupInfo.item[0].ipPermissions.item[0].ipRanges.item[0].cidrIp.should.equal "0.0.0.0/0"
143
-
143
+
144
144
  response.securityGroupInfo.item[1].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
145
145
  response.securityGroupInfo.item[1].groupName.should.equal "RangedPortsBySource"
146
146
  response.securityGroupInfo.item[1].groupDescription.should.equal "A"
@@ -150,17 +150,17 @@ context "EC2 security groups " do
150
150
  response.securityGroupInfo.item[1].ipPermissions.item[0].groups.should.be.nil
151
151
  response.securityGroupInfo.item[1].ipPermissions.item[0].ipRanges.should.be.nil
152
152
  end
153
-
154
-
153
+
154
+
155
155
  specify "method describe_security_groups should reject bad arguments" do
156
156
  @ec2.stubs(:make_request).with('DescribeSecurityGroups', {"GroupName.1"=>"WebServers"}).
157
157
  returns stub(:body => @describe_security_groups_response_body, :is_a? => true)
158
-
158
+
159
159
  lambda { @ec2.describe_security_groups( :group_name => "WebServers" ) }.should.not.raise(EC2::ArgumentError)
160
-
160
+
161
161
  end
162
-
163
-
162
+
163
+
164
164
  specify "permissions should be able to be added to a security group with authorize_security_group_ingress." do
165
165
  @ec2.stubs(:make_request).with('AuthorizeSecurityGroupIngress', { "GroupName"=>"WebServers",
166
166
  "IpProtocol"=>"tcp",
@@ -170,18 +170,18 @@ context "EC2 security groups " do
170
170
  "SourceSecurityGroupName"=>"Source SG Name",
171
171
  "SourceSecurityGroupOwnerId"=>"123"}).
172
172
  returns stub(:body => @authorize_security_group_ingress_response_body, :is_a? => true)
173
-
174
- @ec2.authorize_security_group_ingress( :group_name => "WebServers",
175
- :ip_protocol => "tcp",
176
- :from_port => "8000",
177
- :to_port => "80",
178
- :cidr_ip => "0.0.0.0/24",
173
+
174
+ @ec2.authorize_security_group_ingress( :group_name => "WebServers",
175
+ :ip_protocol => "tcp",
176
+ :from_port => "8000",
177
+ :to_port => "80",
178
+ :cidr_ip => "0.0.0.0/24",
179
179
  :source_security_group_name => "Source SG Name",
180
180
  :source_security_group_owner_id => "123"
181
181
  ).should.be.an.instance_of EC2::Response
182
182
  end
183
-
184
-
183
+
184
+
185
185
  specify "permissions should be able to be revoked from a security group with revoke_security_group_ingress." do
186
186
  @ec2.stubs(:make_request).with('RevokeSecurityGroupIngress', { "GroupName"=>"WebServers",
187
187
  "IpProtocol"=>"tcp",
@@ -191,15 +191,15 @@ context "EC2 security groups " do
191
191
  "SourceSecurityGroupName"=>"Source SG Name",
192
192
  "SourceSecurityGroupOwnerId"=>"123"}).
193
193
  returns stub(:body => @revoke_security_group_ingress_response_body, :is_a? => true)
194
-
195
- @ec2.revoke_security_group_ingress( :group_name => "WebServers",
196
- :ip_protocol => "tcp",
197
- :from_port => "8000",
198
- :to_port => "80",
199
- :cidr_ip => "0.0.0.0/24",
194
+
195
+ @ec2.revoke_security_group_ingress( :group_name => "WebServers",
196
+ :ip_protocol => "tcp",
197
+ :from_port => "8000",
198
+ :to_port => "80",
199
+ :cidr_ip => "0.0.0.0/24",
200
200
  :source_security_group_name => "Source SG Name",
201
201
  :source_security_group_owner_id => "123"
202
202
  ).should.be.an.instance_of EC2::Response
203
203
  end
204
-
204
+
205
205
  end
@@ -11,34 +11,34 @@
11
11
  require File.dirname(__FILE__) + '/test_helper.rb'
12
12
 
13
13
  context "The EC2 Gem " do
14
-
15
-
14
+
15
+
16
16
  setup do
17
17
  @major = 0
18
18
  @minor = 2
19
- @tiny = 5
19
+ @tiny = 6
20
20
  @string = [@major, @minor, @tiny].join('.')
21
21
  end
22
-
23
-
22
+
23
+
24
24
  specify "should have an up to date MAJOR version" do
25
25
  EC2::VERSION::MAJOR.should.equal @major
26
26
  end
27
-
28
-
27
+
28
+
29
29
  specify "should have an up to date MINOR version" do
30
30
  EC2::VERSION::MINOR.should.equal @minor
31
31
  end
32
-
33
-
32
+
33
+
34
34
  specify "should have an up to date TINY version" do
35
35
  EC2::VERSION::TINY.should.equal @tiny
36
36
  end
37
-
38
-
37
+
38
+
39
39
  specify "should return a proper version string when #STRING is called" do
40
40
  EC2::VERSION::STRING.should.equal @string
41
41
  end
42
-
43
-
42
+
43
+
44
44
  end
@@ -8,7 +8,7 @@
8
8
  # Home:: http://amazon-ec2.rubyforge.org
9
9
  #++
10
10
 
11
- %w[ test/unit rubygems test/spec mocha stubba ].each { |f|
11
+ %w[ test/unit rubygems test/spec mocha stubba ].each { |f|
12
12
  begin
13
13
  require f
14
14
  rescue LoadError
@@ -33,7 +33,7 @@
33
33
  <h1>Amazon Web Services EC2 Ruby Gem</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/amazon-ec2"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/amazon-ec2" class="numbers">0.2.5</a>
36
+ <a href="http://rubyforge.org/projects/amazon-ec2" class="numbers">0.2.6</a>
37
37
  </div>
38
38
  <h2>&#x2192; &#8216;amazon-ec2&#8217;</h2>
39
39
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: amazon-ec2
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.5
7
- date: 2007-09-26 00:00:00 -07:00
6
+ version: 0.2.6
7
+ date: 2007-10-16 00:00:00 -07:00
8
8
  summary: An interface library that allows Ruby or Ruby on Rails applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate server instances.
9
9
  require_paths:
10
10
  - lib
@@ -68,8 +68,6 @@ files:
68
68
  - test/test_EC2_security_groups.rb
69
69
  - test/test_EC2_version.rb
70
70
  - test/test_helper.rb
71
- - website/announce.html
72
- - website/announce.txt
73
71
  - website/index.html
74
72
  - website/index.txt
75
73
  - website/javascripts/rounded_corners_lite.inc.js