aboisvert_aws 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/History.txt +329 -0
  2. data/Manifest.txt +61 -0
  3. data/README.txt +163 -0
  4. data/Rakefile +130 -0
  5. data/lib/acf/right_acf_interface.rb +549 -0
  6. data/lib/acf/right_acf_invalidations.rb +144 -0
  7. data/lib/acf/right_acf_origin_access_identities.rb +230 -0
  8. data/lib/acf/right_acf_streaming_interface.rb +229 -0
  9. data/lib/acw/right_acw_interface.rb +248 -0
  10. data/lib/as/right_as_interface.rb +698 -0
  11. data/lib/awsbase/benchmark_fix.rb +39 -0
  12. data/lib/awsbase/right_awsbase.rb +1343 -0
  13. data/lib/awsbase/support.rb +35 -0
  14. data/lib/awsbase/version.rb +9 -0
  15. data/lib/ec2/right_ec2.rb +541 -0
  16. data/lib/ec2/right_ec2_ebs.rb +481 -0
  17. data/lib/ec2/right_ec2_images.rb +444 -0
  18. data/lib/ec2/right_ec2_instances.rb +788 -0
  19. data/lib/ec2/right_ec2_monitoring.rb +70 -0
  20. data/lib/ec2/right_ec2_placement_groups.rb +108 -0
  21. data/lib/ec2/right_ec2_reserved_instances.rb +184 -0
  22. data/lib/ec2/right_ec2_security_groups.rb +491 -0
  23. data/lib/ec2/right_ec2_spot_instances.rb +422 -0
  24. data/lib/ec2/right_ec2_tags.rb +139 -0
  25. data/lib/ec2/right_ec2_vpc.rb +590 -0
  26. data/lib/ec2/right_ec2_vpc2.rb +381 -0
  27. data/lib/ec2/right_ec2_windows_mobility.rb +84 -0
  28. data/lib/elb/right_elb_interface.rb +573 -0
  29. data/lib/emr/right_emr_interface.rb +727 -0
  30. data/lib/iam/right_iam_access_keys.rb +71 -0
  31. data/lib/iam/right_iam_groups.rb +195 -0
  32. data/lib/iam/right_iam_interface.rb +341 -0
  33. data/lib/iam/right_iam_mfa_devices.rb +67 -0
  34. data/lib/iam/right_iam_users.rb +251 -0
  35. data/lib/rds/right_rds_interface.rb +1384 -0
  36. data/lib/right_aws.rb +86 -0
  37. data/lib/route_53/right_route_53_interface.rb +640 -0
  38. data/lib/s3/right_s3.rb +1138 -0
  39. data/lib/s3/right_s3_interface.rb +1278 -0
  40. data/lib/sdb/active_sdb.rb +1107 -0
  41. data/lib/sdb/right_sdb_interface.rb +762 -0
  42. data/lib/sns/right_sns_interface.rb +286 -0
  43. data/lib/sqs/right_sqs.rb +387 -0
  44. data/lib/sqs/right_sqs_gen2.rb +342 -0
  45. data/lib/sqs/right_sqs_gen2_interface.rb +523 -0
  46. data/lib/sqs/right_sqs_interface.rb +593 -0
  47. data/right_aws.gemspec +90 -0
  48. data/test/README.mdown +39 -0
  49. data/test/acf/test_helper.rb +2 -0
  50. data/test/acf/test_right_acf.rb +138 -0
  51. data/test/awsbase/test_helper.rb +2 -0
  52. data/test/awsbase/test_right_awsbase.rb +11 -0
  53. data/test/ec2/test_helper.rb +2 -0
  54. data/test/ec2/test_right_ec2.rb +107 -0
  55. data/test/elb/test_helper.rb +2 -0
  56. data/test/elb/test_right_elb.rb +43 -0
  57. data/test/http_connection.rb +87 -0
  58. data/test/rds/test_helper.rb +2 -0
  59. data/test/rds/test_right_rds.rb +120 -0
  60. data/test/route_53/fixtures/a_record.xml +18 -0
  61. data/test/route_53/fixtures/alias_record.xml +18 -0
  62. data/test/route_53/test_helper.rb +2 -0
  63. data/test/route_53/test_right_route_53.rb +141 -0
  64. data/test/s3/test_helper.rb +2 -0
  65. data/test/s3/test_right_s3.rb +528 -0
  66. data/test/s3/test_right_s3_stubbed.rb +97 -0
  67. data/test/sdb/test_active_sdb.rb +357 -0
  68. data/test/sdb/test_batch_put_attributes.rb +54 -0
  69. data/test/sdb/test_helper.rb +3 -0
  70. data/test/sdb/test_right_sdb.rb +253 -0
  71. data/test/sns/test_helper.rb +2 -0
  72. data/test/sns/test_right_sns.rb +153 -0
  73. data/test/sqs/test_helper.rb +2 -0
  74. data/test/sqs/test_right_sqs.rb +285 -0
  75. data/test/sqs/test_right_sqs_gen2.rb +264 -0
  76. data/test/test_credentials.rb +37 -0
  77. data/test/ts_right_aws.rb +15 -0
  78. metadata +257 -0
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ require File.dirname(__FILE__) + '/test_helper.rb'
3
+
4
+ class TestSdb < Test::Unit::TestCase
5
+
6
+ def setup
7
+ STDOUT.sync = true
8
+ @domain = 'right_sdb_awesome_test_domain'
9
+ @attributes = {
10
+ 'a' => { 'foo' => '123' },
11
+ 'b' => { 'bar' => '456' }
12
+ }
13
+ # Interface instance
14
+ @sdb = Rightscale::SdbInterface.new
15
+ @sdb.delete_domain(@domain)
16
+ wait(SDB_DELAY, "after removing domain")
17
+ @sdb.create_domain(@domain)
18
+ wait(SDB_DELAY, "after recreating domain")
19
+ end
20
+
21
+ SDB_DELAY = 2
22
+
23
+ def wait(delay, msg='')
24
+ print "waiting #{delay} seconds #{msg}"
25
+ while delay>0 do
26
+ delay -= 1
27
+ print '.'
28
+ sleep 1
29
+ end
30
+ puts
31
+ end
32
+
33
+ def test_batch_put_attributes
34
+ @sdb.batch_put_attributes(@domain, @attributes)
35
+ wait(SDB_DELAY, "after putting attributes")
36
+ a = @sdb.get_attributes(@domain, 'a')[:attributes]
37
+ b = @sdb.get_attributes(@domain, 'b')[:attributes]
38
+ assert_equal( {'foo' => ['123']}, a)
39
+ assert_equal( {'bar' => ['456']}, b)
40
+
41
+ # Replace = false
42
+ @sdb.batch_put_attributes(@domain, { 'a' => {'foo' => ['789']}})
43
+ wait(SDB_DELAY, "after putting attributes")
44
+ a = @sdb.get_attributes(@domain, 'a')[:attributes]
45
+ assert_equal ['123', '789'], a['foo'].sort
46
+
47
+ # Replace = true
48
+ @sdb.batch_put_attributes(@domain, {'b' => {'bar' => ['789']}}, true)
49
+ wait(SDB_DELAY, "after putting attributes")
50
+ b = @sdb.get_attributes(@domain, 'b')[:attributes]
51
+ assert_equal ['789'], b['bar'].sort
52
+
53
+ end
54
+ end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/right_aws'
3
+ require 'sdb/active_sdb'
@@ -0,0 +1,253 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestSdb < Test::Unit::TestCase
4
+
5
+ def setup
6
+ STDOUT.sync = true
7
+ @domain = 'right_sdb_awesome_test_domain'
8
+ @item = 'toys'
9
+ @attr = { 'Jon' => %w{beer car} }
10
+ # Interface instance
11
+ @sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
12
+ end
13
+
14
+ SDB_DELAY = 7
15
+
16
+ def wait(delay, msg='')
17
+ print "waiting #{delay} seconds #{msg}"
18
+ while delay>0 do
19
+ delay -= 1
20
+ print '.'
21
+ sleep 1
22
+ end
23
+ puts
24
+ end
25
+
26
+ #---------------------------
27
+ # Rightscale::SdbInterface
28
+ #---------------------------
29
+
30
+ def test_00_delete_domain
31
+ # delete the domain to reset all the things
32
+ assert @sdb.delete_domain(@domain), 'delete_domain fail'
33
+ wait SDB_DELAY, 'after domain deletion'
34
+ end
35
+
36
+ def test_01_create_domain
37
+ # check that domain does not exist
38
+ assert !@sdb.list_domains[:domains].include?(@domain)
39
+ # create domain
40
+ assert @sdb.create_domain(@domain), 'create_domain fail'
41
+ wait SDB_DELAY, 'after domain creation'
42
+ # check that we have received new domain from Amazin
43
+ assert @sdb.list_domains[:domains].include?(@domain)
44
+ end
45
+
46
+ def test_02_put_attributes
47
+ # put attributes
48
+ assert @sdb.put_attributes(@domain, @item, @attr)
49
+ wait SDB_DELAY, 'after putting attributes'
50
+ end
51
+
52
+ def test_03_get_attributes
53
+ # get attributes
54
+ values = Array(@sdb.get_attributes(@domain, @item)[:attributes]['Jon']).sort
55
+ # compare to original list
56
+ assert_equal values, @attr['Jon'].sort
57
+ end
58
+
59
+ def test_04_add_attributes
60
+ # add new attribute
61
+ new_value = 'girls'
62
+ @sdb.put_attributes @domain, @item, {'Jon' => new_value}
63
+ wait SDB_DELAY, 'after putting attributes'
64
+ # get attributes ('girls' must be added to already existent attributes)
65
+ values = Array(@sdb.get_attributes(@domain, @item)[:attributes]['Jon']).sort
66
+ assert_equal values, (@attr['Jon'] << new_value).sort
67
+ end
68
+
69
+ def test_05_replace_attributes
70
+ # replace attributes
71
+ @sdb.put_attributes @domain, @item, {'Jon' => 'pub'}, :replace
72
+ wait SDB_DELAY, 'after replacing attributes'
73
+ # get attributes (all must be removed except of 'pub')
74
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
75
+ assert_equal values, ['pub']
76
+ end
77
+
78
+ def test_06_delete_attribute
79
+ # add value 'girls' and 'vodka' to 'Jon'
80
+ @sdb.put_attributes @domain, @item, {'Jon' => ['girls','vodka']}
81
+ wait SDB_DELAY, 'after adding attributes'
82
+ # get attributes ('girls' and 'vodka' must be added 'pub')
83
+ values = Array(@sdb.get_attributes(@domain, @item)[:attributes]['Jon']).sort
84
+ assert_equal values, ['girls', 'pub', 'vodka']
85
+ # delete a single value 'girls' from attribute 'Jon'
86
+ @sdb.delete_attributes @domain, @item, 'Jon' => ['girls']
87
+ wait SDB_DELAY, 'after the deletion of attribute'
88
+ # get attributes ('girls' must be removed)
89
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
90
+ assert_equal values, ['pub', 'vodka']
91
+ # delete all values from attribute 'Jon'
92
+ @sdb.delete_attributes @domain, @item, ['Jon']
93
+ wait SDB_DELAY, 'after the deletion of attributes'
94
+ # get attributes (values must be empty)
95
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Jon']
96
+ assert_equal values, nil
97
+ end
98
+
99
+ def test_07_delete_item
100
+ @sdb.put_attributes @domain, @item, {'Volodya' => ['girls','vodka']}
101
+ wait SDB_DELAY, 'after adding attributes'
102
+ # get attributes ('girls' and 'vodka' must be there)
103
+ values = Array(@sdb.get_attributes(@domain, @item)[:attributes]['Volodya']).sort
104
+ assert_equal values, ['girls', 'vodka']
105
+ # delete an item
106
+ @sdb.delete_attributes @domain, @item
107
+ wait SDB_DELAY, 'after deleting attributes'
108
+ # get attributes (values must be empty)
109
+ values = @sdb.get_attributes(@domain, @item)[:attributes]['Volodya']
110
+ assert_equal values, nil
111
+ end
112
+
113
+ def test_08_query
114
+ # add some values for query
115
+ @sdb.put_attributes @domain, @item, {'Jon' => ['girls','vodka']}
116
+ wait SDB_DELAY, 'after adding attributes'
117
+ items = @sdb.query(@domain, ['[?=?]', 'Jon','vodka'])[:items]
118
+ assert_equal items.size, 1
119
+ assert_equal items.first, @item
120
+ end
121
+
122
+ def test_09_signature_version_0
123
+ sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '0')
124
+ item = 'toys'
125
+ # TODO: need to change the below test. I think Juergen's intention was to include some umlauts in the values
126
+ # put attributes
127
+ # mhhh... Not sure how to translate this: hölzchehn klötzchen grÃŒnspan buße... Lets assume this is:
128
+ attributes = { 'Jurgen' => %w{kitten puppy chickabiddy piglet} }
129
+ assert sdb.put_attributes(@domain, item, attributes)
130
+ wait SDB_DELAY, 'after putting attributes'
131
+ # get attributes
132
+ values = Array(sdb.get_attributes(@domain, item)[:attributes]['Jurgen']).sort
133
+ # compare to original list
134
+ assert_equal values, attributes['Jurgen'].sort
135
+ # check that the request has correct signature version
136
+ assert sdb.last_request.path.include?('SignatureVersion=0')
137
+ end
138
+
139
+ def test_10_signature_version_1
140
+ sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '1')
141
+ domains = nil
142
+ assert_nothing_thrown "Failed to use signature V1" do
143
+ domains = sdb.list_domains
144
+ end
145
+ assert domains
146
+ end
147
+
148
+ def test_11_signature_version_1
149
+ sdb = Rightscale::SdbInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key, :signature_version => '2')
150
+ domains = nil
151
+ assert_nothing_thrown "Failed to use signature V2" do
152
+ domains = sdb.list_domains
153
+ end
154
+ assert domains
155
+ end
156
+
157
+ def test_12_array_of_attrs
158
+ item = 'multiples'
159
+ assert_nothing_thrown "Failed to put multiple attrs" do
160
+ @sdb.put_attributes(@domain, item, {:one=>1, :two=>2, :three=>3})
161
+ end
162
+ end
163
+
164
+ def test_13_zero_len_attrs
165
+ item = 'zeroes'
166
+ assert_nothing_thrown "Failed to put zero-length attributes" do
167
+ @sdb.put_attributes(@domain, item, {:one=>"", :two=>"", :three=>""})
168
+ end
169
+ end
170
+
171
+ def test_14_nil_attrs
172
+ item = 'nils'
173
+ res = nil
174
+ assert_nothing_thrown do
175
+ @sdb.put_attributes(@domain, item, {:one=>nil, :two=>nil, :three=>'chunder'})
176
+ end
177
+ wait SDB_DELAY, 'after putting attributes'
178
+ assert_nothing_thrown do
179
+ res = @sdb.get_attributes(@domain, item)
180
+ end
181
+ assert_nil(res[:attributes]['one'][0])
182
+ assert_nil(res[:attributes]['two'][0])
183
+ assert_not_nil(res[:attributes]['three'][0])
184
+ end
185
+
186
+ def test_15_url_escape
187
+ item = 'urlescapes'
188
+ content = {:a=>"one & two & three",
189
+ :b=>"one ? two / three"}
190
+ @sdb.put_attributes(@domain, item, content)
191
+ wait SDB_DELAY, 'after putting attributes'
192
+
193
+ res = @sdb.get_attributes(@domain, item)
194
+ assert_equal(content[:a], res[:attributes]['a'][0])
195
+ assert_equal(content[:b], res[:attributes]['b'][0])
196
+ end
197
+
198
+ def test_16_put_attrs_by_post
199
+ item = 'reqgirth'
200
+ i = 0
201
+ sa = ""
202
+ while(i < 64) do
203
+ sa += "aaaaaaaa"
204
+ i += 1
205
+ end
206
+ @sdb.put_attributes(@domain, item, {:a => sa, :b => sa, :c => sa, :d => sa, :e => sa})
207
+ wait SDB_DELAY, 'after putting attributes'
208
+ end
209
+
210
+ def test_20_query_with_atributes
211
+ response = @sdb.query_with_attributes(@domain)
212
+ # convers response to a hash representation
213
+ items = {};
214
+ response[:items].each{ |item| items.merge!(item) }
215
+ # check we have receied all 5 items each full of attributes
216
+ assert_equal 6, items.keys.size
217
+ assert items['toys'].size > 0
218
+ assert items['nils'].size > 0
219
+ assert items['urlescapes'].size > 0
220
+ assert items['multiples'].size > 0
221
+ assert items['reqgirth'].size > 0
222
+ assert items['zeroes'].size > 0
223
+ # fetch only Jon's attributes from all items
224
+ response = @sdb.query_with_attributes(@domain,['Jon'])
225
+ items = {};
226
+ response[:items].each{ |item| items.merge!(item) }
227
+ # check we have receied all 5 items
228
+ # check we have receied all 5 items, but only 'toys' has attributes
229
+ puts items.inspect
230
+ assert_equal 2, items['toys']['Jon'].size
231
+ assert_equal 0, items['nils'].size
232
+ assert_equal 0, items['urlescapes'].size
233
+ assert_equal 0, items['multiples'].size
234
+ assert_equal 0, items['reqgirth'].size
235
+ assert_equal 0, items['zeroes'].size
236
+ # kust Jurgen's attriburs
237
+ response = @sdb.query_with_attributes(@domain,['Jurgen'], "['Jurgen'='piglet']")
238
+ items = {};
239
+ response[:items].each{ |item| items.merge!(item) }
240
+ # check we have receied an only item
241
+ assert_equal 1, items.keys.size
242
+ assert_equal ["chickabiddy", "kitten", "piglet", "puppy"], items['toys']['Jurgen'].sort
243
+ end
244
+
245
+ # Keep this test last, because it deletes the domain...
246
+ def test_21_delete_domain
247
+ assert @sdb.delete_domain(@domain), 'delete_domain fail'
248
+ wait SDB_DELAY, 'after domain deletion'
249
+ # check that domain does not exist
250
+ assert !@sdb.list_domains[:domains].include?(@domain)
251
+ end
252
+
253
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../../lib/right_aws'
@@ -0,0 +1,153 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestSns < Test::Unit::TestCase
4
+
5
+ # You can change these things to whatever you like
6
+ @@subscriber_email = 'foo@bar.baz'
7
+ @@topic_name = 'RightTestTopic'
8
+ @@topic_display_name = 'right_aws test notification topic'
9
+ @@queue_name = "sns_subscribe_queue_#{Time.now.utc.to_i}"
10
+
11
+ # These are placeholders for values that get set, and consumed during the course of testing.
12
+ @@topic_arn = ''
13
+ @@subscription_arn = ''
14
+ @@queue_url = ''
15
+ @@queue_arn = ''
16
+
17
+ @@policy_template = <<-EOF
18
+ {
19
+ "Id": "Policy1300753700208",
20
+ "Statement": [
21
+ {
22
+ "Sid": "Stmt1300753696680",
23
+ "Action": [
24
+ "SNS:Publish",
25
+ "SNS:RemovePermission",
26
+ "SNS:SetTopicAttributes",
27
+ "SNS:DeleteTopic",
28
+ "SNS:ListSubscriptionsByTopic",
29
+ "SNS:GetTopicAttributes",
30
+ "SNS:Receive",
31
+ "SNS:AddPermission",
32
+ "SNS:Subscribe"
33
+ ],
34
+ "Effect": "Allow",
35
+ "Resource": "@@topic_arn@@",
36
+ "Principal": {
37
+ "AWS": [
38
+ "*"
39
+ ]
40
+ }
41
+ }
42
+ ]
43
+ }
44
+ EOF
45
+
46
+ def policy_text
47
+ @@policy_template.gsub('@@topic_arn@@', @@topic_arn)
48
+ end
49
+
50
+ def setup
51
+ @sns = Rightscale::SnsInterface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
52
+ @sqs = Rightscale::SqsGen2Interface.new(TestCredentials.aws_access_key_id, TestCredentials.aws_secret_access_key)
53
+ end
54
+
55
+ def test_01_create_topic
56
+ response = @sns.create_topic(@@topic_name)
57
+ assert_not_nil(response)
58
+ @@topic_arn = response
59
+ end
60
+
61
+ def test_02_set_topic_attributes
62
+ response = @sns.set_topic_attribute(@@topic_arn, 'Policy', policy_text())
63
+ assert_not_nil(response)
64
+
65
+ response = @sns.set_topic_attribute(@@topic_arn, 'DisplayName', @@topic_display_name)
66
+ assert_not_nil(response)
67
+
68
+ assert_raise ArgumentError do
69
+ @sns.set_topic_attribute(@@topic_arn, 'Foo', 'val')
70
+ end
71
+ end
72
+
73
+ def test_03_get_topic_attributes
74
+ response = @sns.get_topic_attributes(@@topic_arn)
75
+ assert_not_nil(response)
76
+ assert(response['DisplayName'] == @@topic_display_name)
77
+ assert(response['Policy'] =~ /Policy1300753700208/)
78
+ end
79
+
80
+ def test_04_list_topics
81
+ sleep(1)
82
+ assert(@sns.list_topics.collect{|topic| topic[:arn] }.include?(@@topic_arn))
83
+ end
84
+
85
+ def test_05_subscribe_email
86
+ response = @sns.subscribe(@@topic_arn, 'email', @@subscriber_email)
87
+ assert_not_nil(response)
88
+ @@subscription_arn = response
89
+ end
90
+
91
+ def test_06_list_subscriptions
92
+ sleep(1)
93
+
94
+ response = @sns.list_subscriptions()
95
+ assert_not_nil(response)
96
+ assert(response.count == 1)
97
+ assert(response[0][:endpoint] == @@subscriber_email)
98
+ assert(response[0][:protocol] == 'email')
99
+ assert(response[0][:subscription_arn] == 'PendingConfirmation')
100
+ assert(response[0][:topic_arn] == @@topic_arn)
101
+ end
102
+
103
+ def test_07_list_subscriptions_by_topic
104
+ response = @sns.list_subscriptions(@@topic_arn)
105
+ assert_not_nil(response)
106
+ assert(response.count == 1)
107
+ assert(response[0][:endpoint] == @@subscriber_email)
108
+ assert(response[0][:protocol] == 'email')
109
+ assert(response[0][:subscription_arn] == 'PendingConfirmation')
110
+ assert(response[0][:topic_arn] == @@topic_arn)
111
+ end
112
+
113
+ def test_08_unsubscribe
114
+ @@queue_url = @sqs.create_queue(@@queue_name)
115
+ @@queue_arn = "arn:aws:sqs:us-east-1:#{TestCredentials.account_number.gsub('-','')}:#{@@queue_name}"
116
+ sub_response = @sns.subscribe(@@topic_arn, 'sqs', @@queue_arn)
117
+ assert_not_nil(sub_response)
118
+ unsub_response = @sns.unsubscribe(sub_response)
119
+ @sqs.delete_queue(@@queue_url)
120
+ end
121
+
122
+ def test_09_publish
123
+ response = @sns.publish(@@topic_arn, 'Message to publish', 'Message Subject')
124
+ assert_not_nil(response)
125
+ end
126
+
127
+ def test_10_add_and_remove_permission
128
+ acct_num = TestCredentials.account_number.gsub('-','')
129
+
130
+ add_response = @sns.add_permission(@@topic_arn, 'PermissionLbl', [
131
+ {:aws_account_id => acct_num, :action => "GetTopicAttributes"},
132
+ {:aws_account_id => acct_num, :action => "Publish"}
133
+ ])
134
+ assert_not_nil(add_response)
135
+
136
+ remove_response = @sns.remove_permission(@@topic_arn, 'PermissionLbl')
137
+ assert_not_nil(remove_response)
138
+ end
139
+
140
+ # TODO: Cannot easily test confirming subscription because it's only valid for http(s) and email subscriptions.
141
+ # Since we don't want to setup an email box or HTTP server to recive the token, we can't really simulate this
142
+ # def test_10_confirm_subscription
143
+ # response = @sns.confirm_subscription(@@topic_arn, 'SomeToken')
144
+ # assert_not_null(response)
145
+ # end
146
+
147
+ def test_30_delete_topic
148
+ response = @sns.delete_topic(@@topic_arn)
149
+ assert_not_nil(response)
150
+ sleep(1)
151
+ assert(!@sns.list_topics.collect{|topic| topic[:arn] }.include?(@@topic_arn))
152
+ end
153
+ end