propono 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e24f186302b02c6e3a2896ab707fbbcc2cd6b447
4
- data.tar.gz: 813ea1ee8356ae861fc0f5b77f84eb08b5497b26
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTg5ZWEwODk0YTc2YWVmNDA4NTAxMDMwMjM2M2ZhNWI0NGFjMmFjMg==
5
+ data.tar.gz: !binary |-
6
+ NjhlZjgyNDhlMTNmYWI2ODdjZTc5OTcyNmZlMzdiYmQ2M2NmZmVjMg==
5
7
  SHA512:
6
- metadata.gz: 28b340921d2d6681824f219864f1875c9f3136670ea869aa621a8a3a5d23326a4fcac618abb39e1313b8075497906a95fa7d5da573839f01766b82436019f1b7
7
- data.tar.gz: 0adc3c6ef53887926106b62c60ca6a4fd0800a5519ffd48bd9ea792ecc0320404d37d679668955d81fdb5e0d50e9760369e5074b35c864d4c64447d18136b974
8
+ metadata.gz: !binary |-
9
+ YTlmNzBhNGQ0NGM3OTMyMzZmMmRiYWVkNTZjMTRjZDRhM2MwY2VkZjdhZGZl
10
+ ODU0MDJlNDk4MjE2YmQ4MTA4ZmRmOTEwNGFlZjJlZDE4OWIyOGZmYzlkODhl
11
+ NGE5YzY0NTg5YThkZTM1NjQ0MjRjNTQ3NTViZjY4YzMzOTQ5YjE=
12
+ data.tar.gz: !binary |-
13
+ OWEyZWZjNDRjYzdjNTExYTk5NzI1M2U0NmI3OTdiYmI3ZGU0MmFiOThmZGVj
14
+ MmNlODQyZDNiMWFhZDQwNjljOGEwZjJiOWIzZGY5Njc2Y2JkZDY0NDc0ODE0
15
+ NWM1N2E0YWQzOWFlY2U5N2QwNTg4MmJkZmZlMDliYzQyYWM5NGM=
@@ -20,7 +20,7 @@ module Propono
20
20
  @topic = TopicCreator.find_or_create(@topic_id)
21
21
  @queue = QueueCreator.find_or_create(queue_name)
22
22
  sns.subscribe(@topic.arn, @queue.arn, 'sqs')
23
- sqs.set_queue_attributes(@queue.url, "Policy", policy)
23
+ sqs.set_queue_attributes(@queue.url, "Policy", generate_policy)
24
24
  end
25
25
 
26
26
  def queue_name
@@ -33,28 +33,23 @@ module Propono
33
33
  Configuration.instance
34
34
  end
35
35
 
36
- def policy
36
+ def generate_policy
37
37
  <<-EOS
38
- {
39
- "Version": "2008-10-17",
40
- "Id": "arn:aws:sqs:eu-west-1:950417255687:manual_queue/SQSDefaultPolicy",
41
- "Statement": [
42
- {
43
- "Sid": "Sid1382106399628",
44
- "Effect": "Allow",
45
- "Principal": {
46
- "AWS": "*"
47
- },
48
- "Action": "SQS:SendMessage",
49
- "Resource": "arn:aws:sqs:eu-west-1:950417255687:manual_queue",
50
- "Condition": {
51
- "ArnEquals": {
52
- "aws:SourceArn": "arn:aws:sns:eu-west-1:950417255687:metrics"
53
- }
54
- }
55
- }
56
- ]
57
- }
38
+ {
39
+ "Version": "2008-10-17",
40
+ "Id": "#{@queue.arn}/SQSDefaultPolicy",
41
+ "Statement": [
42
+ {
43
+ "Sid": "#{@queue.arn}-Sid",
44
+ "Effect": "Allow",
45
+ "Principal": {
46
+ "AWS": "*"
47
+ },
48
+ "Action": "SQS:*",
49
+ "Resource": "#{@queue.arn}"
50
+ }
51
+ ]
52
+ }
58
53
  EOS
59
54
  end
60
55
  end
@@ -32,12 +32,13 @@ module Propono
32
32
  end
33
33
  rescue
34
34
  config.logger.puts "Unexpected error reading from queue #{queue_url}"
35
+ config.logger.puts $!
35
36
  end
36
37
 
37
38
  def process_messages(messages)
38
39
  messages.each do |message|
39
40
  @message_processor.call(message)
40
- sqs.delete_message(message['ReceiptHandle'])
41
+ sqs.delete_message(queue_url, message['ReceiptHandle'])
41
42
  end
42
43
  true
43
44
  end
@@ -1,3 +1,3 @@
1
1
  module Propono
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
@@ -35,11 +35,14 @@ module Propono
35
35
  sqs = mock()
36
36
  sqs.stubs(receive_message: message_response)
37
37
 
38
- sqs.expects(:delete_message).with(@receipt_handle1)
39
- sqs.expects(:delete_message).with(@receipt_handle2)
38
+ queue_url = "test-queue-url"
39
+
40
+ sqs.expects(:delete_message).with(queue_url,@receipt_handle1)
41
+ sqs.expects(:delete_message).with(queue_url,@receipt_handle2)
40
42
 
41
43
  queue_listener = QueueListener.new(@topic_id) { }
42
44
  queue_listener.stubs(sqs: sqs)
45
+ queue_listener.stubs(queue_url: queue_url)
43
46
 
44
47
  queue_listener.send(:read_messages)
45
48
  end
@@ -88,7 +91,7 @@ module Propono
88
91
  out, err = capture_io do
89
92
  queue_listener.send(:read_messages)
90
93
  end
91
- assert_equal "Unexpected error reading from queue http://example.com\n", err
94
+ assert_equal "Unexpected error reading from queue http://example.com\nStandardError\n", err
92
95
  end
93
96
 
94
97
  def test_exception_from_sqs_returns_false
@@ -64,7 +64,7 @@ module Propono
64
64
  sqs.expects(:set_queue_attributes).with(Fog::AWS::SQS::Mock::QueueUrl, "Policy", policy)
65
65
  subscription = QueueSubscription.new("Some topic")
66
66
  subscription.stubs(sqs: sqs)
67
- subscription.stubs(policy: policy)
67
+ subscription.stubs(generate_policy: policy)
68
68
  subscription.create
69
69
  end
70
70
 
@@ -76,5 +76,9 @@ module Propono
76
76
  subscription.create
77
77
  assert_equal queue, subscription.queue
78
78
  end
79
+
80
+ def test_generate_policy
81
+ skip"TODO - Implement this test."
82
+ end
79
83
  end
80
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - MalcyL
@@ -43,28 +43,28 @@ dependencies:
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ! '>='
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: mocha
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
@@ -137,12 +137,12 @@ require_paths:
137
137
  - lib
138
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - '>='
140
+ - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - '>='
145
+ - - ! '>='
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  requirements: []