toccatore 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,7 @@ http_interactions:
21
21
  message: ''
22
22
  headers:
23
23
  Date:
24
- - Fri, 25 May 2018 15:27:17 GMT
24
+ - Sun, 27 May 2018 17:51:47 GMT
25
25
  Content-Type:
26
26
  - application/json; charset=UTF-8
27
27
  Content-Length:
@@ -33,9 +33,9 @@ http_interactions:
33
33
  Vary:
34
34
  - Origin
35
35
  X-Runtime:
36
- - '0.090128'
36
+ - '0.098917'
37
37
  X-Request-Id:
38
- - 75a18fd4-6a4f-48e9-afe4-0dc091fdd909
38
+ - fe86a8de-1ac7-49f3-b63e-0b8c6b64d552
39
39
  X-Powered-By:
40
40
  - Phusion Passenger 5.3.1
41
41
  Server:
@@ -46,7 +46,7 @@ http_interactions:
46
46
  Mysql2::Error: Duplicate entry ''https://metrics.test.datacite.org/reports/2018-3-Dash-https://do''
47
47
  for key ''index_events_on_multiple_columns'': UPDATE `events` SET `subj_id`
48
48
  = ''https://metrics.test.datacite.org/reports/2018-3-Dash'', `source_token`
49
- = ''43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc'', `updated_at` = ''2018-05-25 15:27:17'',
49
+ = ''43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc'', `updated_at` = ''2018-05-27 17:51:46'',
50
50
  `subj` = ''{\\\"pid\\\":\\\"https://metrics.test.datacite.org/reports/2018-3-Dash\\\",\\\"issued\\\":\\\"2128-04-09\\\"}''
51
51
  WHERE `events`.`id` = 337\u003e","traces":{"Application Trace":[{"id":58,"trace":"app/controllers/events_controller.rb:30:in
52
52
  `update''"}],"Framework Trace":[{"id":0,"trace":"vendor/bundle/ruby/2.4.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in
@@ -285,5 +285,5 @@ http_interactions:
285
285
  `block (3 levels) in start_threads''"},{"id":117,"trace":"/usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in
286
286
  `block in create_thread_and_abort_on_exception''"}]}}'
287
287
  http_version:
288
- recorded_at: Fri, 25 May 2018 15:27:17 GMT
288
+ recorded_at: Sun, 27 May 2018 17:51:47 GMT
289
289
  recorded_with: VCR 3.0.3
@@ -14,12 +14,12 @@ http_interactions:
14
14
  User-Agent:
15
15
  - aws-sdk-ruby3/3.21.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
16
16
  X-Amz-Date:
17
- - 20180525T152239Z
17
+ - 20180528T101149Z
18
18
  X-Amz-Content-Sha256:
19
19
  - 5761efd13dd0ed81182207171d3660628968189941431d6044920ef8fe7b1160
20
20
  Authorization:
21
- - AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180525/eu-west-1/sqs/aws4_request,
22
- SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=a6edcb7489579924dcfc1f37a6f9cabc8b74403288d8ceb4da86c56c117fbec5
21
+ - AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180528/eu-west-1/sqs/aws4_request,
22
+ SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=27a47caa3eef618bb34d16a20b68bbd2e687dd9dfbd0a8916de116b4018715a8
23
23
  Content-Length:
24
24
  - '58'
25
25
  Accept:
@@ -32,7 +32,7 @@ http_interactions:
32
32
  Server:
33
33
  - Server
34
34
  Date:
35
- - Fri, 25 May 2018 15:22:39 GMT
35
+ - Mon, 28 May 2018 10:11:49 GMT
36
36
  Content-Type:
37
37
  - text/xml
38
38
  Content-Length:
@@ -40,10 +40,10 @@ http_interactions:
40
40
  Connection:
41
41
  - keep-alive
42
42
  X-Amzn-Requestid:
43
- - 84b68241-77a2-598f-a68e-d1c35bdd2f7b
43
+ - 9f9d4e4a-0871-5085-ae8d-1dcfd054721c
44
44
  body:
45
45
  encoding: UTF-8
46
- string: <?xml version="1.0"?><GetQueueUrlResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><GetQueueUrlResult><QueueUrl>https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage</QueueUrl></GetQueueUrlResult><ResponseMetadata><RequestId>84b68241-77a2-598f-a68e-d1c35bdd2f7b</RequestId></ResponseMetadata></GetQueueUrlResponse>
46
+ string: <?xml version="1.0"?><GetQueueUrlResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><GetQueueUrlResult><QueueUrl>https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage</QueueUrl></GetQueueUrlResult><ResponseMetadata><RequestId>9f9d4e4a-0871-5085-ae8d-1dcfd054721c</RequestId></ResponseMetadata></GetQueueUrlResponse>
47
47
  http_version:
48
- recorded_at: Fri, 25 May 2018 15:22:39 GMT
48
+ recorded_at: Mon, 28 May 2018 10:11:49 GMT
49
49
  recorded_with: VCR 3.0.3
@@ -33,14 +33,14 @@ describe Toccatore::UsageUpdate, vcr: true do
33
33
  end
34
34
  end
35
35
 
36
- context "when there are NOT messages" do
37
- it "should return empty" do
38
- sqs.stub_responses(:receive_message, messages: [])
39
- response = sqs.receive_message({queue_url: queue_url})
40
- response = subject.get_data(response)
41
- expect(response.body["errors"]).to eq("Queue is empty")
42
- end
43
- end
36
+ # context "when there are NOT messages" do
37
+ # it "should return empty" do
38
+ # sqs.stub_responses(:receive_message, messages: [])
39
+ # response = sqs.receive_message({queue_url: queue_url})
40
+ # response = subject.get_data(response)
41
+ # expect(response.body["errors"]).to eq("Queue is empty")
42
+ # end
43
+ # end
44
44
  end
45
45
 
46
46
  describe "parse_data" do
@@ -121,6 +121,13 @@ describe Toccatore::UsageUpdate, vcr: true do
121
121
  expect(subject.push_data(result, options)).to eq(4)
122
122
  end
123
123
 
124
+ it "should fail if format of the event is empty" do
125
+ body = File.read(fixture_path + 'events_empty.json')
126
+ result = JSON.parse(body)
127
+ options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['ACCESS_TOKEN'], jsonapi: true }
128
+ expect(subject.push_data(result, options)).to eq(1)
129
+ end
130
+
124
131
  # it "should work with DataCite Event Data 2" do
125
132
  # dd = events.map {|event| event.to_h.stringify_keys}
126
133
  # all_events = dd.map {|item| item.map{ |k, v| [k.dasherize, v] }.to_h}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toccatore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-25 00:00:00.000000000 Z
11
+ date: 2018-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -341,6 +341,7 @@ files:
341
341
  - spec/fixtures/datacite_related_nil.json
342
342
  - spec/fixtures/event_data_resp_1
343
343
  - spec/fixtures/event_data_resp_2
344
+ - spec/fixtures/events_empty.json
344
345
  - spec/fixtures/orcid_update.json
345
346
  - spec/fixtures/orcid_update_is_identical.json
346
347
  - spec/fixtures/orcid_update_is_part.json
@@ -396,6 +397,7 @@ files:
396
397
  - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml
397
398
  - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml
398
399
  - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml
400
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml
399
401
  - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml
400
402
  - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml
401
403
  - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml