amazon-ec2 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,123 @@
1
+ #--
2
+ # Amazon Web Services EC2 Query API Ruby library
3
+ #
4
+ # Ruby Gem Name:: amazon-ec2
5
+ # Author:: Glenn Rempe (mailto:glenn@elasticworkbench.com)
6
+ # Copyright:: Copyright (c) 2007 Glenn Rempe
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://amazon-ec2.rubyforge.org
9
+ #++
10
+
11
+ require File.dirname(__FILE__) + '/test_helper.rb'
12
+
13
+ context "EC2 keypairs " do
14
+
15
+ setup do
16
+ @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
+
18
+ @create_keypair_response_body = <<-RESPONSE
19
+ <CreateKeyPairResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19">
20
+ <keyName>example-key-name</keyName>
21
+ <keyFingerprint>1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f</keyFingerprint>
22
+ <keyMaterial>-----BEGIN RSA PRIVATE KEY-----
23
+ MIIEoQIBAAKCAQBuLFg5ujHrtm1jnutSuoO8Xe56LlT+HM8v/xkaa39EstM3/aFxTHgElQiJLChp
24
+ HungXQ29VTc8rc1bW0lkdi23OH5eqkMHGhvEwqa0HWASUMll4o3o/IX+0f2UcPoKCOVUR+jx71Sg
25
+ 5AU52EQfanIn3ZQ8lFW7Edp5a3q4DhjGlUKToHVbicL5E+g45zfB95wIyywWZfeW/UUF3LpGZyq/
26
+ ebIUlq1qTbHkLbCC2r7RTn8vpQWp47BGVYGtGSBMpTRP5hnbzzuqj3itkiLHjU39S2sJCJ0TrJx5
27
+ i8BygR4s3mHKBj8l+ePQxG1kGbF6R4yg6sECmXn17MRQVXODNHZbAgMBAAECggEAY1tsiUsIwDl5
28
+ 91CXirkYGuVfLyLflXenxfI50mDFms/mumTqloHO7tr0oriHDR5K7wMcY/YY5YkcXNo7mvUVD1pM
29
+ ZNUJs7rw9gZRTrf7LylaJ58kOcyajw8TsC4e4LPbFaHwS1d6K8rXh64o6WgW4SrsB6ICmr1kGQI7
30
+ 3wcfgt5ecIu4TZf0OE9IHjn+2eRlsrjBdeORi7KiUNC/pAG23I6MdDOFEQRcCSigCj+4/mciFUSA
31
+ SWS4dMbrpb9FNSIcf9dcLxVM7/6KxgJNfZc9XWzUw77Jg8x92Zd0fVhHOux5IZC+UvSKWB4dyfcI
32
+ tE8C3p9bbU9VGyY5vLCAiIb4qQKBgQDLiO24GXrIkswF32YtBBMuVgLGCwU9h9HlO9mKAc2m8Cm1
33
+ jUE5IpzRjTedc9I2qiIMUTwtgnw42auSCzbUeYMURPtDqyQ7p6AjMujp9EPemcSVOK9vXYL0Ptco
34
+ xW9MC0dtV6iPkCN7gOqiZXPRKaFbWADp16p8UAIvS/a5XXk5jwKBgQCKkpHi2EISh1uRkhxljyWC
35
+ iDCiK6JBRsMvpLbc0v5dKwP5alo1fmdR5PJaV2qvZSj5CYNpMAy1/EDNTY5OSIJU+0KFmQbyhsbm
36
+ rdLNLDL4+TcnT7c62/aH01ohYaf/VCbRhtLlBfqGoQc7+sAc8vmKkesnF7CqCEKDyF/dhrxYdQKB
37
+ gC0iZzzNAapayz1+JcVTwwEid6j9JqNXbBc+Z2YwMi+T0Fv/P/hwkX/ypeOXnIUcw0Ih/YtGBVAC
38
+ DQbsz7LcY1HqXiHKYNWNvXgwwO+oiChjxvEkSdsTTIfnK4VSCvU9BxDbQHjdiNDJbL6oar92UN7V
39
+ rBYvChJZF7LvUH4YmVpHAoGAbZ2X7XvoeEO+uZ58/BGKOIGHByHBDiXtzMhdJr15HTYjxK7OgTZm
40
+ gK+8zp4L9IbvLGDMJO8vft32XPEWuvI8twCzFH+CsWLQADZMZKSsBasOZ/h1FwhdMgCMcY+Qlzd4
41
+ JZKjTSu3i7vhvx6RzdSedXEMNTZWN4qlIx3kR5aHcukCgYA9T+Zrvm1F0seQPbLknn7EqhXIjBaT
42
+ P8TTvW/6bdPi23ExzxZn7KOdrfclYRph1LHMpAONv/x2xALIf91UB+v5ohy1oDoasL0gij1houRe
43
+ 2ERKKdwz0ZL9SWq6VTdhr/5G994CK72fy5WhyERbDjUIdHaK3M849JJuf8cSrvSb4g==
44
+ -----END RSA PRIVATE KEY-----</keyMaterial>
45
+ </CreateKeyPairResponse>
46
+ RESPONSE
47
+
48
+ @describe_keypairs_response_body = <<-RESPONSE
49
+ <DescribeKeyPairsResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19">
50
+ <keySet>
51
+ <item>
52
+ <keyName>example-key-name</keyName>
53
+ <keyFingerprint>1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f</keyFingerprint>
54
+ </item>
55
+ </keySet>
56
+ </DescribeKeyPairsResponse>
57
+ RESPONSE
58
+
59
+ @delete_keypair_body = <<-RESPONSE
60
+ <DeleteKeyPair xmlns="http://ec2.amazonaws.com/doc/2007-01-19">
61
+ <return>true</return>
62
+ </DeleteKeyPair>
63
+ RESPONSE
64
+
65
+ end
66
+
67
+
68
+ specify "should be able to be created" do
69
+ @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
70
+ returns stub(:body => @create_keypair_response_body, :is_a? => true)
71
+
72
+ @ec2.create_keypair( :key_name => "example-key-name" ).should.be.an.instance_of EC2::Response
73
+
74
+ response = @ec2.create_keypair( :key_name => "example-key-name" )
75
+ response.keyName.should.equal "example-key-name"
76
+ response.keyFingerprint.should.equal "1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f"
77
+ response.keyMaterial.should.not.equal ""
78
+ response.keyMaterial.should.not.be.nil
79
+ end
80
+
81
+
82
+ specify "method create_keypair should reject bad arguments" do
83
+ @ec2.stubs(:make_request).with('CreateKeyPair', {"KeyName"=>"example-key-name"}).
84
+ returns stub(:body => @create_keypair_response_body, :is_a? => true)
85
+
86
+ lambda { @ec2.create_keypair( :key_name => "example-key-name" ) }.should.not.raise(EC2::ArgumentError)
87
+ lambda { @ec2.create_keypair() }.should.raise(EC2::ArgumentError)
88
+ lambda { @ec2.create_keypair( :key_name => nil ) }.should.raise(EC2::ArgumentError)
89
+ lambda { @ec2.create_keypair( :key_name => "" ) }.should.raise(EC2::ArgumentError)
90
+ end
91
+
92
+
93
+ specify "should be able to be described with describe_keypairs" do
94
+ @ec2.stubs(:make_request).with('DescribeKeyPairs', {"KeyName.1"=>"example-key-name"}).
95
+ returns stub(:body => @describe_keypairs_response_body, :is_a? => true)
96
+ @ec2.describe_keypairs( :key_name => "example-key-name" ).should.be.an.instance_of EC2::Response
97
+ response = @ec2.describe_keypairs( :key_name => "example-key-name" )
98
+ response.keySet.item[0].keyName.should.equal "example-key-name"
99
+ response.keySet.item[0].keyFingerprint.should.equal "1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f"
100
+ end
101
+
102
+
103
+ specify "should be able to be deleted with delete_keypairs" do
104
+ @ec2.stubs(:make_request).with('DeleteKeyPair', {"KeyName"=>"example-key-name"}).
105
+ returns stub(:body => @delete_keypair_body, :is_a? => true)
106
+ @ec2.delete_keypair( :key_name => "example-key-name" ).should.be.an.instance_of EC2::Response
107
+ response = @ec2.delete_keypair( :key_name => "example-key-name" )
108
+ response.return.should.equal "true"
109
+ end
110
+
111
+
112
+ specify "method delete_keypair should reject bad argument" do
113
+ @ec2.stubs(:make_request).with('DeleteKeyPair', {"KeyName"=>"example-key-name"}).
114
+ returns stub(:body => @delete_keypair_body, :is_a? => true)
115
+
116
+ lambda { @ec2.delete_keypair( :key_name => "example-key-name" ) }.should.not.raise(EC2::ArgumentError)
117
+ lambda { @ec2.delete_keypair() }.should.raise(EC2::ArgumentError)
118
+ lambda { @ec2.delete_keypair( :key_name => nil ) }.should.raise(EC2::ArgumentError)
119
+ lambda { @ec2.delete_keypair( :key_name => "" ) }.should.raise(EC2::ArgumentError)
120
+ end
121
+
122
+
123
+ end
@@ -0,0 +1,102 @@
1
+ #--
2
+ # Amazon Web Services EC2 Query API Ruby library
3
+ #
4
+ # Ruby Gem Name:: amazon-ec2
5
+ # Author:: Glenn Rempe (mailto:glenn@elasticworkbench.com)
6
+ # Copyright:: Copyright (c) 2007 Glenn Rempe
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://amazon-ec2.rubyforge.org
9
+ #++
10
+
11
+ require File.dirname(__FILE__) + '/test_helper.rb'
12
+
13
+ context "The Response classes " do
14
+
15
+
16
+ setup do
17
+ @http_xml = <<-RESPONSE
18
+ <RebootInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19">
19
+ <return>true</return>
20
+ </RebootInstancesResponse>
21
+ RESPONSE
22
+
23
+ @response = EC2::Response.parse(:xml => @http_xml)
24
+
25
+ # test out adding arbitrary new values to the OpenStruct
26
+ @response.name = "foo"
27
+ @response.number = '123'
28
+ end
29
+
30
+
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)
34
+ # that are nine chars long.
35
+ @response.to_string(true).should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} ...>/
36
+ end
37
+
38
+
39
+ specify "should properly run the to_string(false) method for the long version" do
40
+ @response.to_string(false).should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} name=\"foo\" number=\"123\" parent=nil return=\"true\"/
41
+ end
42
+
43
+
44
+ specify "should properly run the to_string(false) method for the long version when called with no params" do
45
+ @response.to_string.should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} name=\"foo\" number=\"123\" parent=nil return=\"true\"/
46
+ end
47
+
48
+
49
+ specify "should provide the same results from to_s as from to_string(false) " do
50
+ @response.to_s.should =~ /^#<EC2::Response:0x[0-9A-F]{1,9} name=\"foo\" number=\"123\" parent=nil return=\"true\"/
51
+ end
52
+
53
+
54
+ specify "should be a kind of type OpenStruct" do
55
+ @response.kind_of?(OpenStruct).should.equal true
56
+ @response.kind_of?(Enumerable).should.equal true
57
+ end
58
+
59
+
60
+ specify "should return its members" do
61
+ @response.members.length.should.equal 6
62
+ test_array = ["return", "xmlns", "number", "name", "parent", "xml"].sort
63
+ @response.members.sort.should.equal test_array
64
+ end
65
+
66
+
67
+ specify "should properly respond to its 'each' method" do
68
+ answer = @response.each do |f| f ; end
69
+ answer.name.should.equal "foo"
70
+ answer.number.should.equal '123'
71
+ end
72
+
73
+
74
+ specify "should respond to the '[]' method" do
75
+ @response[:name].should.equal "foo"
76
+ end
77
+
78
+
79
+ specify "should respond correctly to the '[]=' method and set a variable" do
80
+ @response[:name].should.equal "foo"
81
+ @response[:name]="bar"
82
+ @response[:name].should.equal "bar"
83
+ end
84
+
85
+
86
+ specify "should respond correctly to the 'each_pair' method" do
87
+ @response.each_pair {|k,v|
88
+ case k
89
+ when "name"
90
+ v.should.equal "foo"
91
+ when "number"
92
+ v.should.equal '123'
93
+ end
94
+ }
95
+ end
96
+
97
+ specify "should return the original amazon XML response in the 'xml' attribute of the response object." do
98
+ @response.xml.should.equal @http_xml
99
+ end
100
+
101
+
102
+ end
@@ -0,0 +1,205 @@
1
+ #--
2
+ # Amazon Web Services EC2 Query API Ruby library
3
+ #
4
+ # Ruby Gem Name:: amazon-ec2
5
+ # Author:: Glenn Rempe (mailto:glenn@elasticworkbench.com)
6
+ # Copyright:: Copyright (c) 2007 Glenn Rempe
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://amazon-ec2.rubyforge.org
9
+ #++
10
+
11
+ require File.dirname(__FILE__) + '/test_helper.rb'
12
+
13
+ context "EC2 security groups " do
14
+
15
+ setup do
16
+ @ec2 = EC2::Base.new( :access_key_id => "not a key", :secret_access_key => "not a secret" )
17
+
18
+ @create_security_group_response_body = <<-RESPONSE
19
+ <CreateSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19">
20
+ <return>true</return>
21
+ </CreateSecurityGroupResponse>
22
+ RESPONSE
23
+
24
+ @delete_security_group_response_body = <<-RESPONSE
25
+ <DeleteSecurityGroupResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19">
26
+ <return>true</return>
27
+ </DeleteSecurityGroupResponse>
28
+ RESPONSE
29
+
30
+ @describe_security_groups_response_body = <<-RESPONSE
31
+ <DescribeSecurityGroupsResponse xm-lns="http://ec2.amazonaws.com/doc/2007-01-19">
32
+ <securityGroupInfo>
33
+ <item>
34
+ <ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
35
+ <groupName>WebServers</groupName>
36
+ <groupDescription>Web</groupDescription>
37
+ <ipPermissions>
38
+ <item>
39
+ <ipProtocol>tcp</ipProtocol>
40
+ <fromPort>80</fromPort>
41
+ <toPort>80</toPort>
42
+ <groups/>
43
+ <ipRanges>
44
+ <item>
45
+ <cidrIp>0.0.0.0/0</cidrIp>
46
+ </item>
47
+ </ipRanges>
48
+ </item>
49
+ </ipPermissions>
50
+ </item>
51
+ <item>
52
+ <ownerId>UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM</ownerId>
53
+ <groupName>RangedPortsBySource</groupName>
54
+ <groupDescription>A</groupDescription>
55
+ <ipPermissions>
56
+ <item>
57
+ <ipProtocol>tcp</ipProtocol>
58
+ <fromPort>6000</fromPort>
59
+ <toPort>7000</toPort>
60
+ <groups/>
61
+ <ipRanges/>
62
+ </item>
63
+ </ipPermissions>
64
+ </item>
65
+ </securityGroupInfo>
66
+ </DescribeSecurityGroupsResponse>
67
+ RESPONSE
68
+
69
+ @authorize_security_group_ingress_response_body = <<-RESPONSE
70
+ <AuthorizeSecurityGroupIngressResponse xm-lns="http://ec2.amazonaws.com/doc/2007-01-19">
71
+ <return>true</return>
72
+ </AuthorizeSecurityGroupIngressResponse>
73
+ RESPONSE
74
+
75
+ @revoke_security_group_ingress_response_body = <<-RESPONSE
76
+ <RevokeSecurityGroupIngressResponse xm-lns="http://ec2.amazonaws.com/doc/2007-01-19">
77
+ <return>true</return>
78
+ </RevokeSecurityGroupIngressResponse>
79
+ RESPONSE
80
+
81
+ end
82
+
83
+
84
+ specify "should be able to be created" do
85
+ @ec2.stubs(:make_request).with('CreateSecurityGroup', {"GroupName"=>"WebServers", "GroupDescription"=>"Web"}).
86
+ returns stub(:body => @create_security_group_response_body, :is_a? => true)
87
+ @ec2.create_security_group( :group_name => "WebServers", :group_description => "Web" ).should.be.an.instance_of EC2::Response
88
+ end
89
+
90
+
91
+ specify "method create_security_group should reject bad arguments" do
92
+ @ec2.stubs(:make_request).with('CreateSecurityGroup', {"GroupName"=>"WebServers", "GroupDescription"=>"Web"}).
93
+ returns stub(:body => @create_security_group_response_body, :is_a? => true)
94
+
95
+ lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "Web" ) }.should.not.raise(EC2::ArgumentError)
96
+ lambda { @ec2.create_security_group() }.should.raise(EC2::ArgumentError)
97
+
98
+ # :group_name can't be nil or empty
99
+ lambda { @ec2.create_security_group( :group_name => "", :group_description => "Web" ) }.should.raise(EC2::ArgumentError)
100
+ lambda { @ec2.create_security_group( :group_name => nil, :group_description => "Web" ) }.should.raise(EC2::ArgumentError)
101
+
102
+ # :group_description can't be nil or empty
103
+ lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => "" ) }.should.raise(EC2::ArgumentError)
104
+ lambda { @ec2.create_security_group( :group_name => "WebServers", :group_description => nil ) }.should.raise(EC2::ArgumentError)
105
+ end
106
+
107
+
108
+ specify "should be able to be deleted" do
109
+ @ec2.stubs(:make_request).with('DeleteSecurityGroup', {"GroupName"=>"WebServers"}).
110
+ returns stub(:body => @delete_security_group_response_body, :is_a? => true)
111
+ @ec2.delete_security_group( :group_name => "WebServers" ).should.be.an.instance_of EC2::Response
112
+ end
113
+
114
+
115
+ specify "method delete_security_group should reject bad arguments" do
116
+ @ec2.stubs(:make_request).with('DeleteSecurityGroup', {"GroupName"=>"WebServers"}).
117
+ returns stub(:body => @delete_security_group_response_body, :is_a? => true)
118
+
119
+ lambda { @ec2.delete_security_group( :group_name => "WebServers" ) }.should.not.raise(EC2::ArgumentError)
120
+ lambda { @ec2.delete_security_group() }.should.raise(EC2::ArgumentError)
121
+
122
+ # :group_name can't be nil or empty
123
+ lambda { @ec2.delete_security_group( :group_name => "" ) }.should.raise(EC2::ArgumentError)
124
+ lambda { @ec2.delete_security_group( :group_name => nil ) }.should.raise(EC2::ArgumentError)
125
+ end
126
+
127
+
128
+ specify "should be able to be described with describe_security_groups" do
129
+ @ec2.stubs(:make_request).with('DescribeSecurityGroups', { "GroupName.1" => "WebServers", "GroupName.2" => "RangedPortsBySource" }).
130
+ returns stub(:body => @describe_security_groups_response_body, :is_a? => true)
131
+ @ec2.describe_security_groups( :group_name => ["WebServers", "RangedPortsBySource"] ).should.be.an.instance_of EC2::Response
132
+
133
+ response = @ec2.describe_security_groups( :group_name => ["WebServers", "RangedPortsBySource"] )
134
+
135
+ response.securityGroupInfo.item[0].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
136
+ response.securityGroupInfo.item[0].groupName.should.equal "WebServers"
137
+ response.securityGroupInfo.item[0].groupDescription.should.equal "Web"
138
+ response.securityGroupInfo.item[0].ipPermissions.item[0].ipProtocol.should.equal "tcp"
139
+ response.securityGroupInfo.item[0].ipPermissions.item[0].fromPort.should.equal "80"
140
+ response.securityGroupInfo.item[0].ipPermissions.item[0].toPort.should.equal "80"
141
+ response.securityGroupInfo.item[0].ipPermissions.item[0].groups.should.be.nil
142
+ response.securityGroupInfo.item[0].ipPermissions.item[0].ipRanges.item[0].cidrIp.should.equal "0.0.0.0/0"
143
+
144
+ response.securityGroupInfo.item[1].ownerId.should.equal "UYY3TLBUXIEON5NQVUUX6OMPWBZIQNFM"
145
+ response.securityGroupInfo.item[1].groupName.should.equal "RangedPortsBySource"
146
+ response.securityGroupInfo.item[1].groupDescription.should.equal "A"
147
+ response.securityGroupInfo.item[1].ipPermissions.item[0].ipProtocol.should.equal "tcp"
148
+ response.securityGroupInfo.item[1].ipPermissions.item[0].fromPort.should.equal "6000"
149
+ response.securityGroupInfo.item[1].ipPermissions.item[0].toPort.should.equal "7000"
150
+ response.securityGroupInfo.item[1].ipPermissions.item[0].groups.should.be.nil
151
+ response.securityGroupInfo.item[1].ipPermissions.item[0].ipRanges.should.be.nil
152
+ end
153
+
154
+
155
+ specify "method describe_security_groups should reject bad arguments" do
156
+ @ec2.stubs(:make_request).with('DescribeSecurityGroups', {"GroupName.1"=>"WebServers"}).
157
+ returns stub(:body => @describe_security_groups_response_body, :is_a? => true)
158
+
159
+ lambda { @ec2.describe_security_groups( :group_name => "WebServers" ) }.should.not.raise(EC2::ArgumentError)
160
+
161
+ end
162
+
163
+
164
+ specify "permissions should be able to be added to a security group with authorize_security_group_ingress." do
165
+ @ec2.stubs(:make_request).with('AuthorizeSecurityGroupIngress', { "GroupName"=>"WebServers",
166
+ "IpProtocol"=>"tcp",
167
+ "FromPort"=>"8000",
168
+ "ToPort"=>"80",
169
+ "CidrIp"=>"0.0.0.0/24",
170
+ "SourceSecurityGroupName"=>"Source SG Name",
171
+ "SourceSecurityGroupOwnerId"=>"123"}).
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",
179
+ :source_security_group_name => "Source SG Name",
180
+ :source_security_group_owner_id => "123"
181
+ ).should.be.an.instance_of EC2::Response
182
+ end
183
+
184
+
185
+ specify "permissions should be able to be revoked from a security group with revoke_security_group_ingress." do
186
+ @ec2.stubs(:make_request).with('RevokeSecurityGroupIngress', { "GroupName"=>"WebServers",
187
+ "IpProtocol"=>"tcp",
188
+ "FromPort"=>"8000",
189
+ "ToPort"=>"80",
190
+ "CidrIp"=>"0.0.0.0/24",
191
+ "SourceSecurityGroupName"=>"Source SG Name",
192
+ "SourceSecurityGroupOwnerId"=>"123"}).
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",
200
+ :source_security_group_name => "Source SG Name",
201
+ :source_security_group_owner_id => "123"
202
+ ).should.be.an.instance_of EC2::Response
203
+ end
204
+
205
+ end
@@ -0,0 +1,44 @@
1
+ #--
2
+ # Amazon Web Services EC2 Query API Ruby library
3
+ #
4
+ # Ruby Gem Name:: amazon-ec2
5
+ # Author:: Glenn Rempe (mailto:glenn@elasticworkbench.com)
6
+ # Copyright:: Copyright (c) 2007 Glenn Rempe
7
+ # License:: Distributes under the same terms as Ruby
8
+ # Home:: http://amazon-ec2.rubyforge.org
9
+ #++
10
+
11
+ require File.dirname(__FILE__) + '/test_helper.rb'
12
+
13
+ context "The EC2 Gem " do
14
+
15
+
16
+ setup do
17
+ @major = 0
18
+ @minor = 2
19
+ @tiny = 0
20
+ @string = [@major, @minor, @tiny].join('.')
21
+ end
22
+
23
+
24
+ specify "should have an up to date MAJOR version" do
25
+ EC2::VERSION::MAJOR.should.equal @major
26
+ end
27
+
28
+
29
+ specify "should have an up to date MINOR version" do
30
+ EC2::VERSION::MINOR.should.equal @minor
31
+ end
32
+
33
+
34
+ specify "should have an up to date TINY version" do
35
+ EC2::VERSION::TINY.should.equal @tiny
36
+ end
37
+
38
+
39
+ specify "should return a proper version string when #STRING is called" do
40
+ EC2::VERSION::STRING.should.equal @string
41
+ end
42
+
43
+
44
+ end