ds_test 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58d19b9b6bd045fcc498cc4f6a4e2793ddec65d1
4
- data.tar.gz: 4e39820242a7ff9c49ab53a23480e0cc62bdc1ff
3
+ metadata.gz: 44b67c985b930e060e8c6cc92b3a7fbf8bb4b305
4
+ data.tar.gz: 01649ad46cd403940dcdd88b7b35304af6bd1f4d
5
5
  SHA512:
6
- metadata.gz: a79b29e99c38e44be83ccf02478c73ddb58e05c35432fb419d08c50f690379c44dd2a979009d55f31272572caf2c19a75e0a56afd5131a673a96abf0c053e356
7
- data.tar.gz: 5babd1e30e99d2d2e0dad3c84999278c2a5d4d7597ee770d689da0fba3cdf2808572f857b2af03a8b2537bc9f9deab456e39ff7f5dead42af541a6f1087248ad
6
+ metadata.gz: f532aee257c68522289c8ba4c8d104ae9368b1dd282c86f251341288f4bd30fb4a9f60a2fb17b063060f9c1551c879fb15646579a0396360e1f56c01bce2ddbd
7
+ data.tar.gz: b1f626f6e476426c03ea11a978cd0843a38f449fbc45b866a9d6dba2d3623d3ae02d3a9de1ce12e6273b155f030ae1d3c89bdbde6ab6eef300b9f63da4c25b22
data/cucumber.out CHANGED
@@ -4,10 +4,19 @@ Característica: Consultar el servicio de bookings fallidos de PAM para ver si e
4
4
 
5
5
  Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas. # features/PAMFailedBookings.feature:7
6
6
  Dado que invoco al servicio de bookings fallidos de PAM # features/step_definitions/PAMFailedBookings_steps.rb:3
7
- Entonces checkeo si hay bookings fallidos # features/step_definitions/PAMFailedBookings_steps.rb:7
8
- Hay 8 reserva(s) fallidas en PAM
7
+ Entonces checkeo si hay bookings fallidos # features/step_definitions/PAMFailedBookings_steps.rb:7
8
+ Hay 8 reserva(s) fallida(s) en PAM:
9
9
  [127779208, 121865108, 124150208, 129322308, 121864608, 113878107, 113470907, 127780208]
10
+ Hay 8 reserva(s) que ya ha(n) sido resuelta(s):
11
+ ["127779208 (Cancelada)", "121865108 (Cancelada)", "124150208 (Cancelada)", "129322308 (Cancelada)", "121864608 (Cancelada)", "113878107 (Cancelada)", "113470907 (Cancelada)", "127780208 (Emitida)"]
12
+  expected: truthy value
13
+  got: false (RSpec::Expectations::ExpectationNotMetError)
14
+  ./features/step_definitions/PAMFailedBookings_steps.rb:15:in `/^checkeo si hay bookings fallidos$/'
15
+  features/PAMFailedBookings.feature:11:in `Entonces checkeo si hay bookings fallidos'
10
16
 
11
- 1 scenario (1 passed)
12
- 2 steps (2 passed)
13
- 0m10.409s
17
+ Failing Scenarios:
18
+ cucumber features/PAMFailedBookings.feature:7 # Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas.
19
+
20
+ 1 scenario (1 failed)
21
+ 2 steps (1 failed, 1 passed)
22
+ 0m18.013s
data/ds_test.gemspec CHANGED
@@ -4,7 +4,7 @@ $:.push File.expand_path("../lib", __FILE__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "ds_test"
7
- gem.version = "0.2.4"
7
+ gem.version = "0.2.5"
8
8
  gem.authors = ["DS QA"]
9
9
  gem.email = ["jdelrio@despegar.com,smendoza@despegar.com"]
10
10
  gem.description = %q{Test de Media}
@@ -2,8 +2,8 @@ def pam_failed_bookings
2
2
  # Consulta el servicio de Bookings Fallidos de PAMFailedBookings
3
3
  # PROD: 10.2.7.16
4
4
  # RC: 10.254.168.100
5
-
6
- @service = HTTParty.get("http://10.2.7.16/ds-pam/service/failedBooking/findAll", :headers =>{'X-UOW' => 'GUIDO-BOT'})
5
+ @ip = '10.2.7.16'
6
+ @service = HTTParty.get("http://#{@ip}/ds-pam/service/failedBooking/findAll", :headers =>{'X-UOW' => 'GUIDO-BOT'})
7
7
  end
8
8
 
9
9
 
@@ -13,26 +13,71 @@ def checkear_respuesta
13
13
  @contenido
14
14
 
15
15
  if @service.nil? or @service.empty? or @service.include? "Error"
16
+
16
17
  puts "Hubo un error al consultar el servicio de Bookings Fallidos de PAM".on_red
17
- resultado = false
18
+ resultado = true
18
19
  end
19
20
 
20
- items = []
21
+ @items = []
22
+ @left_items = []
23
+ @done_items = []
21
24
 
22
25
  if !@service['data'].empty?
23
26
 
24
27
  @service['data'].each do | item |
25
28
 
26
- items << item['crmId']
27
- end
29
+ if !@items.empty?
30
+
31
+ next if @items.to_s.include?(item['crmId'].to_s)
32
+ end
33
+
34
+ if item['bookingServiceType'] == 'ACTIVITY'
35
+
36
+ service_type = 'tours'
37
+ else
38
+
39
+ service_type = 'transfers'
40
+ end
41
+
42
+ fenix_stat = HTTParty.get("http://#{@ip}/fenix/ds/#{service_type}?transaction_id=#{item['crmId']}", :headers =>{'X-UOW' => 'GUIDO-BOT'})
43
+
44
+ if fenix_stat['items'][0]['home_status']['code'].to_s == 'DONE'
45
+
46
+ @done_items << item['crmId'].to_s + ' (Emitida)'
47
+
48
+ elsif fenix_stat['items'][0]['home_status']['code'].to_s == 'CANCELED'
49
+
50
+ @done_items << item['crmId'].to_s + ' (Cancelada)'
51
+
52
+ else
28
53
 
29
- items = items.uniq
54
+ @left_items << item['crmId']
55
+ end
56
+
57
+ @items << item['crmId']
58
+
59
+ end
60
+ end
61
+
62
+ if !@items.empty?
30
63
 
31
- puts "Hay #{items.size} reserva(s) fallidas en PAM"
64
+ puts "Hay #{@items.size} reserva(s) fallida(s) en PAM:"
32
65
 
33
- puts items
66
+ puts @items
67
+
68
+ if !@left_items.empty?
69
+
70
+ puts "Hay #{@left_items.size} reserva(s) pendiente(s):"
71
+
72
+ puts @left_items
73
+ end
34
74
 
35
- @items = items
75
+ if !@done_items.empty?
76
+
77
+ puts "Hay #{@done_items.size} reserva(s) que ya ha(n) sido resuelta(s):"
78
+
79
+ puts @done_items
80
+ end
36
81
 
37
82
  resultado = false
38
83
  else
@@ -47,18 +92,29 @@ end
47
92
 
48
93
  def nuevos_bookings
49
94
 
50
- body_template = '<br><h2># Servicio de alerta de bookings fallidos de DS-PAM #</h2><br><b>Existen nuevas reservas fallidas / pendientes de emisión:</b><br><ul>'
95
+ body_template = '<br><h2># Servicio de alerta de bookings fallidos de DS-PAM #</h2><br><b>Reservas fallidas / pendientes de emisión:</b><br><ul>'
96
+
97
+ if !@left_items.empty?
98
+
99
+ @left_items.each do | left |
100
+ body_template = body_template + '<li>' + left.to_s + '</li>'
101
+ end
102
+ else
103
+ body_template = body_template + 'No hay reservas pendientes'
104
+ end
51
105
 
52
- @items.each do | item |
53
- body_template = body_template + '<li>' + item.to_s + '</li>'
106
+ body_template = body_template + '</ul><br><br><b>Reservas fallidas en PAM que ya han sido resueltas:</b><br><ul>'
107
+
108
+ @done_items.each do | done |
109
+ body_template = body_template + '<li>' + done.to_s + '</li>'
54
110
  end
55
111
 
56
- body_template = body_template + '</ul>'
112
+ body_template = body_template + '<br><br><br><br><br>-Reporte automatizado de DS-QA<br>Dudas o consultas: ds-qa@despegar.com'
57
113
 
58
114
  mail = Mail.new do
59
115
  from 'ds.test.alert@gmail.com'
60
116
  to 'ds-pam@despegar.com, nmelano@despegar.com, reservastkts@despegar.com, ddileo@despegar.com'
61
- subject 'Nuevas reservas fallidas de DS-PAM'
117
+ subject '[Alerta] Reservas fallidas en DS-PAM - DS Automation'
62
118
 
63
119
  html_part do
64
120
  content_type 'text/html; charset=UTF-8'
@@ -84,11 +140,13 @@ def enviar_alerta
84
140
 
85
141
  if semaphore['data']['statusHolder']['status']['status'] == 'ERROR'
86
142
 
87
- if last_items.length < @items.to_s[/\[(.*?)\]/, 1 ].length
143
+ if last_items.to_s.length < @items.to_s[/\[(.*?)\]/, 1 ].length
88
144
 
89
145
  nuevos_bookings
90
146
  end
91
147
  else
92
148
  nuevos_bookings
93
149
  end
150
+
151
+ false
94
152
  end
@@ -2,8 +2,8 @@ def rm_bundle_list
2
2
  # Consulta el servicio de RM que devuelve el listado de Bundles y los items que los componen.
3
3
  # PROD: 10.2.7.16
4
4
  # RC: 10.254.168.100
5
-
6
- @bundles = HTTParty.get("http://10.2.7.16/ds-rm/service/bundles", :headers =>{'X-UOW' => 'GUIDO-BOT'})
5
+ @ip = '10.2.7.16'
6
+ @bundles = HTTParty.get("http://#{@ip}/ds-rm/service/bundles", :headers =>{'X-UOW' => 'GUIDO-BOT'})
7
7
  end
8
8
 
9
9
 
@@ -29,7 +29,7 @@ def checkear_bundles
29
29
  i = 0
30
30
  for i in 0..1 do
31
31
 
32
- record = HTTParty.get("http://10.2.7.16/ds-rm/service/provider-records?tracking_id=#{tracking_id}", :headers =>{'X-UOW' => 'GUIDO-BOT'})
32
+ record = HTTParty.get("http://#{@ip}/ds-rm/service/provider-records?tracking_id=#{tracking_id}", :headers =>{'X-UOW' => 'GUIDO-BOT'})
33
33
 
34
34
  if record.nil? or record.empty? or record.include? 'errors'
35
35
 
@@ -2,8 +2,8 @@ def rm_group_records
2
2
  # Consulta el servicio de Bookings Fallidos de PAMFailedBookings
3
3
  # PROD: 10.2.7.16
4
4
  # RC: 10.254.168.100
5
-
6
- @service = HTTParty.get("http://10.2.7.16/ds-rm/service/group-records", :headers =>{'X-UOW' => 'GUIDO-BOT'})
5
+ @ip = '10.2.7.16'
6
+ @service = HTTParty.get("http://#{@ip}/ds-rm/service/group-records", :headers =>{'X-UOW' => 'GUIDO-BOT'})
7
7
 
8
8
  if @service.nil? or @service.empty? or @service.include? "Error"
9
9
  puts "Hubo un error al consultar el servicio de Grupos de Fichas de RM".on_red
@@ -37,7 +37,7 @@ def checkear_orden
37
37
 
38
38
  id = id.gsub ' ', '%20'
39
39
 
40
- url = "http://10.2.7.16/ds-rm/service/provider-records?tracking_id=#{id}"
40
+ url = "http://#{@ip}/ds-rm/service/provider-records?tracking_id=#{id}"
41
41
 
42
42
  begin
43
43
 
@@ -5,7 +5,12 @@ Dado(/^que invoco al servicio de bookings fallidos de PAM$/) do
5
5
  end
6
6
 
7
7
  Entonces(/^checkeo si hay bookings fallidos$/) do
8
- if !checkear_respuesta
9
- enviar_alerta
8
+
9
+ resultado = checkear_respuesta
10
+
11
+ if !resultado
12
+ enviar_alerta
10
13
  end
14
+
15
+ expect(resultado).to be_truthy
11
16
  end
@@ -5,5 +5,5 @@ Dado(/^que invoco al servicio de quota de media$/) do
5
5
  end
6
6
 
7
7
  Entonces(/^verifico el estado de la quota$/) do
8
- validar_media.should be_truthy
8
+ expect(validar_media).to be_truthy
9
9
  end
data/out.henry CHANGED
@@ -1 +1 @@
1
- {"summary":{"total":1,"breakdownByStatusCode":{"OK":1,"ERROR":0,"WARNING":0}},"tasks":[[{"name":"pam_failed_bookings","code":"OK","message":"OK","returnedData":{"output":"#language: es\n\u001b[36m@pam_failed_bookings\u001b[0m\nCaracterística: Consultar el servicio de bookings fallidos de PAM para ver si existe alguno y generar una alarma para alertar de la situación.\n\n Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas.\u001b[90m # features/PAMFailedBookings.feature:7\u001b[0m\n \u001b[32mDado que invoco al servicio de bookings fallidos de PAM\u001b[90m # features/step_definitions/PAMFailedBookings_steps.rb:3\u001b[0m\u001b[0m\n \u001b[32mEntonces checkeo si hay bookings fallidos\u001b[90m # features/step_definitions/PAMFailedBookings_steps.rb:7\u001b[0m\u001b[0m\n \u001b[36mHay 8 reserva(s) fallidas en PAM\u001b[0m\n \u001b[36m[127779208, 121865108, 124150208, 129322308, 121864608, 113878107, 113470907, 127780208]\u001b[0m\n\n1 scenario (\u001b[32m1 passed\u001b[0m)\n2 steps (\u001b[32m2 passed\u001b[0m)\n0m10.409s\n","backtrace":null},"log":{},"worker":"smendoza-ThinkPad-Edge","parameters":{"env":"rc"}}]]}
1
+ {"summary":{"total":1,"breakdownByStatusCode":{"OK":0,"ERROR":1,"WARNING":0}},"tasks":[[{"name":"pam_failed_bookings","code":"ERROR","message":"exit","returnedData":{"output":"#language: es\n\u001b[36m@pam_failed_bookings\u001b[0m\nCaracterística: Consultar el servicio de bookings fallidos de PAM para ver si existe alguno y generar una alarma para alertar de la situación.\n\n Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas.\u001b[90m # features/PAMFailedBookings.feature:7\u001b[0m\n \u001b[32mDado que invoco al servicio de bookings fallidos de PAM\u001b[90m # features/step_definitions/PAMFailedBookings_steps.rb:3\u001b[0m\u001b[0m\n \u001b[31mEntonces checkeo si hay bookings fallidos\u001b[90m # features/step_definitions/PAMFailedBookings_steps.rb:7\u001b[0m\u001b[0m\n \u001b[36mHay 8 reserva(s) fallida(s) en PAM:\u001b[0m\n \u001b[36m[127779208, 121865108, 124150208, 129322308, 121864608, 113878107, 113470907, 127780208]\u001b[0m\n \u001b[36mHay 8 reserva(s) que ya ha(n) sido resuelta(s):\u001b[0m\n \u001b[36m[\"127779208 (Cancelada)\", \"121865108 (Cancelada)\", \"124150208 (Cancelada)\", \"129322308 (Cancelada)\", \"121864608 (Cancelada)\", \"113878107 (Cancelada)\", \"113470907 (Cancelada)\", \"127780208 (Emitida)\"]\u001b[0m\n\u001b[31m expected: truthy value\u001b[0m\n\u001b[31m got: false (RSpec::Expectations::ExpectationNotMetError)\u001b[0m\n\u001b[31m ./features/step_definitions/PAMFailedBookings_steps.rb:15:in `/^checkeo si hay bookings fallidos$/'\u001b[0m\n\u001b[31m features/PAMFailedBookings.feature:11:in `Entonces checkeo si hay bookings fallidos'\u001b[0m\n\n\u001b[31mFailing Scenarios:\u001b[0m\n\u001b[31mcucumber features/PAMFailedBookings.feature:7\u001b[0m\u001b[90m # Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas.\u001b[0m\n\n1 scenario (\u001b[31m1 failed\u001b[0m)\n2 steps (\u001b[31m1 failed\u001b[0m, \u001b[32m1 passed\u001b[0m)\n0m18.013s\n","backtrace":["/home/smendoza/.rvm/gems/ruby-2.2.2/gems/cucumber-2.0.2/lib/cucumber/rake/task.rb:94:in `exit'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/cucumber-2.0.2/lib/cucumber/rake/task.rb:94:in `block in run'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:57:in `call'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:57:in `sh'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/file_utils_ext.rb:37:in `sh'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/cucumber-2.0.2/lib/cucumber/rake/task.rb:92:in `run'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/cucumber-2.0.2/lib/cucumber/rake/task.rb:143:in `block in define_task'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `call'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `each'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:235:in `execute'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/task/rake_task.rb:23:in `execute'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/container.rb:35:in `block (2 levels) in execute'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/container.rb:28:in `each'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/container.rb:28:in `block in execute'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/container.rb:25:in `each'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/container.rb:25:in `each_with_index'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/lib/henry/container.rb:25:in `execute'","/home/smendoza/.rvm/gems/ruby-2.2.2/gems/henry-container-0.1.14/bin/henry-ruby-container:28:in `<top (required)>'","/home/smendoza/.rvm/gems/ruby-2.2.2/bin/henry-ruby-container:23:in `load'","/home/smendoza/.rvm/gems/ruby-2.2.2/bin/henry-ruby-container:23:in `<main>'","/home/smendoza/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'","/home/smendoza/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'"]},"log":{},"worker":"smendoza-ThinkPad-Edge","parameters":{"env":"rc"}}]]}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ds_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - DS QA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug