ds_test 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 820c97099f1d3c1f490b740084f82c756b022365
4
- data.tar.gz: 8e8c7ac909852b4da5255aad7b11d858ef7f28cd
3
+ metadata.gz: 8d43062c6cc8f3aedc8a5329549029538ff08183
4
+ data.tar.gz: 81510326b64b61d67a8ab57072f462709b19b1cf
5
5
  SHA512:
6
- metadata.gz: 30a880cdb83615cb495db8201089aa521a76137f7c6f6cb4f80e8d8c490d7fb600086f12131d465e370411e03b00190804dbd526b812b368dda491b6cab66159
7
- data.tar.gz: 2152bbb0bf3c8adfd1b6e081991812e9bac60ebfee77fed7112fd60cf5559cccf5649d00ee05c6fb803dfd154bd90db821e5016867d2383b894399bcb765a3ae
6
+ metadata.gz: cdc1444854f029527d6c04ad5ca175041cb05b9e6a72a6bd1d23e28443db6b647a037ab0cf93f70a35c56ef5e2a1572a98f859f6cff038cbbb6ac739d0adbc8b
7
+ data.tar.gz: 9233e29804854e5f95e21606b2f30a27a13455a24bb343c82526b92056df4caf29acc77863f13c5d4c9d128ab5359c989006a3b2bbf10df3ea9d9625c3c60caa
data/.bashrc CHANGED
@@ -1,2 +1,3 @@
1
1
  [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
2
2
  [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
3
+ [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
data/Rakefile CHANGED
@@ -11,7 +11,10 @@ Cucumber::Rake::Task.new(:quotamedia) do |task|
11
11
  task.cucumber_opts = ["#{parametros} log/quotamedia#{t}.html --tags @quota_media"]
12
12
  end
13
13
 
14
-
15
14
  Cucumber::Rake::Task.new(:PAMFailedBookings) do |task|
16
15
  task.cucumber_opts = ["#{parametros} log/PAMFailedBookings#{t}.html --tags @pam_failed_bookings"]
16
+ end
17
+
18
+ Cucumber::Rake::Task.new(:RMBundleStatus) do |task|
19
+ task.cucumber_opts = ["#{parametros} log/RMBundleStatus#{t}.html --tags @rm_bundle_status"]
17
20
  end
data/cucumber.out CHANGED
@@ -1,20 +1,12 @@
1
1
  #language: es
2
- @pam_failed_bookings
3
- Característica: Consultar el servicio de bookings fallidos de PAM para ver si existe alguno y generar una alarma para alertar de la situación.
2
+ @rm_bundle_status
3
+ Característica: Consultar el servicio de listado de Bundles de RM para ver si esta activo y checkear la disponibilidad de los items que los componen.
4
4
 
5
- Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas. # features/PAMFailedBookings.feature:7
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 2 reserva(s) fallidas en PAM
9
- [98244435, 98251526]
10
-  undefined method `[]' for nil:NilClass (NoMethodError)
11
-  ./features/methods/PAMFailedBookings_actions.rb:58:in `enviar_alerta'
12
-  ./features/step_definitions/PAMFailedBookings_steps.rb:11:in `/^checkeo si hay bookings fallidos$/'
13
-  features/PAMFailedBookings.feature:11:in `Entonces checkeo si hay bookings fallidos'
5
+ Escenario: Invocar el servicio de listado de Bundles de RM validando que existan bundles y tengan disponibilidad real. # features/RMBundleStatus.feature:7
6
+ Dado que invoco al servicio de listado de Bundles de RM # features/step_definitions/RMbundleStatus.rb:3
7
+ Entonces checkeo si cada item que los compone tiene disponibilidad # features/step_definitions/RMbundleStatus.rb:7
8
+ Todos los bundles cargados tienen disponibilidad.
14
9
 
15
- Failing Scenarios:
16
- cucumber features/PAMFailedBookings.feature:7 # Escenario: Invocar el servicio de bookings fallidos de PAM validando que existan o no entradas.
17
-
18
- 1 scenario (1 failed)
19
- 2 steps (1 failed, 1 passed)
20
- 0m14.149s
10
+ 1 scenario (1 passed)
11
+ 2 steps (2 passed)
12
+ 0m51.061s
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.1.0"
7
+ gem.version = "0.1.1"
8
8
  gem.authors = ["DS QA"]
9
9
  gem.email = ["jdelrio@despegar.com,smendoza@despegar.com"]
10
10
  gem.description = %q{Test de Media}
@@ -8,4 +8,4 @@
8
8
 
9
9
 
10
10
  Dado que invoco al servicio de bookings fallidos de PAM
11
- Entonces checkeo si hay bookings fallidos
11
+ Entonces checkeo si hay bookings fallidos
@@ -0,0 +1,11 @@
1
+ #language: es
2
+
3
+ @rm_bundle_status
4
+
5
+ Característica: Consultar el servicio de listado de Bundles de RM para ver si esta activo y checkear la disponibilidad de los items que los componen.
6
+
7
+ Escenario: Invocar el servicio de listado de Bundles de RM validando que existan bundles y tengan disponibilidad real.
8
+
9
+
10
+ Dado que invoco al servicio de listado de Bundles de RM
11
+ Entonces checkeo si cada item que los compone tiene disponibilidad
@@ -10,9 +10,11 @@ end
10
10
  def checkear_respuesta
11
11
  # Checkea la respuesta del servicio para ver si hay o no bookings fallidos
12
12
 
13
+ @contenido
14
+
13
15
  if @service.nil? or @service.empty? or @service.include? "Error"
14
16
  puts "Hubo un error al consultar el servicio de Bookings Fallidos de PAM".on_red
15
- resultado=false
17
+ resultado = false
16
18
  end
17
19
 
18
20
  items = []
@@ -41,6 +43,7 @@ def checkear_respuesta
41
43
 
42
44
  end
43
45
 
46
+ resultado
44
47
 
45
48
  end
46
49
 
@@ -72,7 +75,7 @@ def enviar_alerta
72
75
 
73
76
  mail = Mail.new do
74
77
  from 'ds.test.alert@gmail.com'
75
- to 'smendoza@despegar.com'
78
+ to 'smendoza@despegar.com, ds-pam@despegar.com'
76
79
  subject 'Nuevas reservas fallidas de DS-PAM'
77
80
 
78
81
  html_part do
@@ -82,10 +85,8 @@ def enviar_alerta
82
85
  end
83
86
 
84
87
  mail.deliver!
85
-
86
88
  end
87
89
  end
88
-
89
90
  false
91
+ end
90
92
 
91
- end
@@ -0,0 +1,91 @@
1
+ def rm_bundle_list
2
+ # Consulta el servicio de RM que devuelve el listado de Bundles y los items que los componen.
3
+ # PROD: 10.2.7.16
4
+ # RC: 10.254.168.100
5
+
6
+ @bundles = HTTParty.get("http://10.2.7.16/ds-rm/service/bundles/")
7
+ end
8
+
9
+
10
+
11
+ def checkear_bundles
12
+ #Checkea la disponibilidad de cada uno de los items que componen los bundles cargados.
13
+
14
+ if @bundles.nil? or @bundles.empty? or @bundles.include? "error"
15
+ puts "Hubo un error al consultar el servicio de Bundles de RM".on_red
16
+ checkeado = false
17
+ end
18
+
19
+ bundle_info = []
20
+
21
+ if !@bundles.empty?
22
+
23
+ @bundles.each do | check |
24
+
25
+ check['items'].each do | availability |
26
+
27
+ tracking_id = availability['trackingId']
28
+ i = 0
29
+ for i in 0..1 do
30
+
31
+ record = HTTParty.get("http://10.2.7.16/ds-rm/service/provider-records?tracking_id=#{tracking_id}")
32
+
33
+ if record.nil? or record.empty? or record.include? 'errors'
34
+
35
+ i = i + 1
36
+ if i == 2
37
+ bundle_title = check['title']['es']
38
+ bundle_oid = check['oid']
39
+ bundle_info << bundle_title + ' | oid: ' + bundle_oid
40
+ end
41
+ else
42
+ i = 2
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ if !bundle_info.empty?
50
+
51
+ @output = bundle_info.uniq
52
+ puts @output
53
+ false
54
+ else
55
+
56
+ puts 'Todos los bundles cargados tienen disponibilidad.'
57
+ end
58
+ end
59
+
60
+
61
+ def alerta_bundles
62
+ #Genera y envía un e-mail de alerta listando los bundles que contengan items sin disponibilidad.
63
+
64
+ body_template = '<br><h1># Servicio de alerta de Bundles con items sin disponibilidad: #</h1><br><b>Los siguientes Bundles no se estan ofreciendo en el sitio
65
+ porque uno o más de los items que los componen no estan disponibles:</b><br><ul>'
66
+
67
+ @output.each do | item |
68
+ body_template = body_template + '<li>' + item.to_s + '</li>'
69
+ end
70
+
71
+ body_template = body_template + '</ul>' + '<br><br><br><br><br><h3>Para editar los Bundles dirigirse a DS-RAMBO:</h3><br>
72
+ <a href="http://backoffice.despegar.com/ds-rambo/login">
73
+ <img src="http://www.despegar.com/media/pictures/dcba67fc-0775-48d9-b00d-27b8f296af43" alt="Mountain View" style="width:320px;height:85px;">
74
+ </a><br><br><br><br><br>
75
+ -Reporte automatizado de DS-QA<br>
76
+ Dudas o consultas: ds-qa@despegar.com'
77
+
78
+ mail = Mail.new do
79
+ from 'ds.test.alert@gmail.com'
80
+ to 'ds-shopping@despegar.com, dssales-product@despegar.com, nicolas.sacheri@despegar.com, santiago.iribarne@despegar.com'
81
+ subject '[Alerta] Bundles con items sin disponibilidad - DS Automation'
82
+
83
+ html_part do
84
+ content_type 'text/html; charset=UTF-8'
85
+ body body_template
86
+ end
87
+ end
88
+
89
+ mail.deliver!
90
+
91
+ end
@@ -8,5 +8,4 @@
8
8
 
9
9
 
10
10
  Dado que invoco al servicio de quota de media
11
- Entonces verifico el estado de la quota
12
-
11
+ Entonces verifico el estado de la quota
@@ -5,9 +5,7 @@ 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
- resultado = checkear_respuesta
9
- ##resultado.should be_truthy
10
- if !resultado
8
+ if !checkear_respuesta
11
9
  enviar_alerta
12
10
  end
13
11
  end
@@ -0,0 +1,13 @@
1
+ # -*- encoding : utf-8 -*-
2
+ #language: es
3
+ Dado(/^que invoco al servicio de listado de Bundles de RM$/) do
4
+ rm_bundle_list
5
+ end
6
+
7
+ Entonces(/^checkeo si cada item que los compone tiene disponibilidad$/) do
8
+ resultado = checkear_bundles
9
+ ##resultado.should be_truthy
10
+ if !resultado
11
+ alerta_bundles
12
+ end
13
+ end
data/henry-context.yml CHANGED
@@ -20,12 +20,12 @@ tasks:
20
20
  - format: html
21
21
  name: ${DATE}_${TASK_NAME}.html
22
22
 
23
- - name: commission_change
23
+ - name: rm_bundle_status
24
24
  class_name: Henry::Task::CucumberTask
25
25
  options:
26
26
  tags:
27
- - commission_change
27
+ - rm_bundle_status
28
28
  expand: true
29
29
  reports:
30
- - format: html
31
- name: ${DATE}_${TASK_NAME}.html
30
+ - format: html
31
+ name: ${DATE}_${TASK_NAME}.html
@@ -0,0 +1 @@
1
+ {"tasks":["rm_bundle_status"]}
data/out.henry CHANGED
@@ -1 +1 @@
1
- {"summary":{"total":1,"breakdownByStatusCode":{"OK":0,"ERROR":1,"WARNING":0}},"tasks":[[{"name":"pam_failed_bookings","code":"ERROR","message":"","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","backtrace":["/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:82:in `system'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:82:in `rake_system'","/home/smendoza/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/file_utils.rb:54: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"}}]]}
1
+ {"summary":{"total":1,"breakdownByStatusCode":{"OK":1,"ERROR":0,"WARNING":0}},"tasks":[[{"name":"rm_bundle_status","code":"OK","message":"OK","returnedData":{"output":"#language: es\n\u001b[36m@rm_bundle_status\u001b[0m\nCaracterística: Consultar el servicio de listado de Bundles de RM para ver si esta activo y checkear la disponibilidad de los items que los componen.\n\n Escenario: Invocar el servicio de listado de Bundles de RM validando que existan bundles y tengan disponibilidad real.\u001b[90m # features/RMBundleStatus.feature:7\u001b[0m\n \u001b[32mDado que invoco al servicio de listado de Bundles de RM\u001b[90m # features/step_definitions/RMbundleStatus.rb:3\u001b[0m\u001b[0m\n \u001b[32mEntonces checkeo si cada item que los compone tiene disponibilidad\u001b[90m # features/step_definitions/RMbundleStatus.rb:7\u001b[0m\u001b[0m\n \u001b[36mTodos los bundles cargados tienen disponibilidad.\u001b[0m\n\n1 scenario (\u001b[32m1 passed\u001b[0m)\n2 steps (\u001b[32m2 passed\u001b[0m)\n0m51.061s\n","backtrace":null},"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.1.0
4
+ version: 0.1.1
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-01-19 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -203,20 +203,20 @@ files:
203
203
  - cucumber.out.orig
204
204
  - ds_test-0.0.4.gem
205
205
  - ds_test.gemspec
206
- - failedbookings_alert
207
206
  - features/PAMFailedBookings.feature
208
- - features/commissionChange
207
+ - features/RMBundleStatus.feature
209
208
  - features/methods/PAMFailedBookings_actions.rb
209
+ - features/methods/RMbundleStatus.rb
210
210
  - features/methods/actions_media.rb
211
211
  - features/quotamedia.feature
212
212
  - features/step_definitions/PAMFailedBookings_steps.rb
213
- - features/step_definitions/commissionChange_steps
214
- - features/step_definitions/servicios_steps.rb
213
+ - features/step_definitions/RMbundleStatus.rb
214
+ - features/step_definitions/quotamedia.rb
215
215
  - features/support/env.rb
216
216
  - henry-context.yml
217
- - hints.henry
218
217
  - hints.henry.pamfailedbookings
219
218
  - hints.henry.quotamedia
219
+ - hints.henry.rmbundlestatus
220
220
  - in.henry
221
221
  - log/PAMFailedBookings250920151127.html
222
222
  - log/PAMFailedBookings250920151128.html
@@ -247,11 +247,12 @@ specification_version: 4
247
247
  summary: Test automatizados
248
248
  test_files:
249
249
  - features/PAMFailedBookings.feature
250
- - features/commissionChange
250
+ - features/RMBundleStatus.feature
251
251
  - features/methods/PAMFailedBookings_actions.rb
252
+ - features/methods/RMbundleStatus.rb
252
253
  - features/methods/actions_media.rb
253
254
  - features/quotamedia.feature
254
255
  - features/step_definitions/PAMFailedBookings_steps.rb
255
- - features/step_definitions/commissionChange_steps
256
- - features/step_definitions/servicios_steps.rb
256
+ - features/step_definitions/RMbundleStatus.rb
257
+ - features/step_definitions/quotamedia.rb
257
258
  - features/support/env.rb
data/failedbookings_alert DELETED
@@ -1,5 +0,0 @@
1
- <br><h1># Servicio de alerta de bookings fallidos de DS-PAM #</h1><br><br>
2
-
3
- Existen nuevas reservas fallidas pendientes de emisión:<br>
4
-
5
- #{@items}
@@ -1,10 +0,0 @@
1
- #language: es
2
-
3
- @commision_change
4
-
5
- Característica: Consultar el servicio de comisiones especiales de PAM para verificar si cambiaron los coeficientes cargados.
6
-
7
- Escenario: Invocar el servicio de comisiones especiales de PAM validando que hayan cambiado los porcentajes y la diferencia.
8
-
9
- Dado que invoco al servicio de comisiones especiales de PAM
10
- Entonces checkeo si cambiaron los coeficientes de comisiones.
@@ -1,9 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- #language: es
3
- Dado(/^que invoco al servicio de consulta de comisiones especiales$/) do
4
- commission_change
5
- end
6
-
7
- Entonces(/^checkeo si cambiaron los coeficientes de las comisiones$/) do
8
- checkear_respuesta.should be_truthy
9
- end
data/hints.henry DELETED
@@ -1 +0,0 @@
1
- {"tasks":["pam_failed_bookings"]}