ds_test 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ds_test.gemspec +1 -1
- data/features/RMgroupRecordsCostsOrder.feature +11 -0
- data/features/methods/RMgroupRecordsCostsOrder.rb +128 -0
- data/features/step_definitions/RMgroupRecordsCostsOrder.rb +13 -0
- data/hints.henry.rmgrouprecordscostsorder +1 -0
- metadata +8 -2
- data/.bashrc +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2804a6f4ea18c29ff969a962fb0614d2eae35731
|
4
|
+
data.tar.gz: dbeae4941d5b105bfab2e25a01ad1762e235ae1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56856d4921b78a339f5111f81fb4646a3a87f878ad5e5245d26c6a693f2b131a970714d8c44883d1ecb5d46897da2a78e5b7fb054304ef9a6eb20695a8cb1ecb
|
7
|
+
data.tar.gz: 7c2e997957aaccf9ddc02fd5c59ce40a1b8712bf980d6831b6de77fb3a16b195196e7a7e33a6e7a88c230c4b624e8f6157ce57a1079f15a12830a405b7aa188a
|
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.
|
7
|
+
gem.version = "0.2.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}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#language: es
|
2
|
+
|
3
|
+
@rm_group_records_costs_order
|
4
|
+
|
5
|
+
Característica: Consultar el servicio de Grupos de Fichas de RM para ver si existe alguno que tenga orden automático, contenga al menos una actividad de PAM y que la actividad ganadora segun los costos sea de un proveedor distinto de PAM.
|
6
|
+
|
7
|
+
Escenario: Invocar el servicio de grupos de fichas de RM y reportar aquellos grupos con orden automático que contengan actividades de PAM que no ganen la competencia de costos.
|
8
|
+
|
9
|
+
Dado que invoco al servicio de Grupos de Fichas de RM
|
10
|
+
|
11
|
+
Entonces checkeo aquellos grupos con orden Automatico que contengan actividades de PAM y en la competencia de costos gane alguna otra actividad de otro proveedor
|
@@ -0,0 +1,128 @@
|
|
1
|
+
def rm_group_records
|
2
|
+
# Consulta el servicio de Bookings Fallidos de PAMFailedBookings
|
3
|
+
# PROD: 10.2.7.16
|
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'})
|
7
|
+
|
8
|
+
if @service.nil? or @service.empty? or @service.include? "Error"
|
9
|
+
puts "Hubo un error al consultar el servicio de Grupos de Fichas de RM".on_red
|
10
|
+
resultado = false
|
11
|
+
end
|
12
|
+
|
13
|
+
@groups_size = @service.size.to_s
|
14
|
+
|
15
|
+
puts "Hay #{@groups_size} grupos para la consulta"
|
16
|
+
end
|
17
|
+
|
18
|
+
def checkear_orden
|
19
|
+
# Checkea la respuesta del servicio para ver si hay grupos con orden automático que contengan atividades de PAM donde las mismas no ganen el primer orden por Costos.
|
20
|
+
|
21
|
+
resultado = false
|
22
|
+
|
23
|
+
costs = []
|
24
|
+
pam_costs = []
|
25
|
+
@report = []
|
26
|
+
|
27
|
+
if !@service.empty?
|
28
|
+
|
29
|
+
@service.each do | group |
|
30
|
+
|
31
|
+
if group['trackingIds'].to_s.include?("PAM") && !group['useOrder']
|
32
|
+
|
33
|
+
group['trackingIds'].each do | id |
|
34
|
+
|
35
|
+
id = id.gsub ' ', '%20'
|
36
|
+
|
37
|
+
url = "http://10.2.7.16/ds-rm/service/provider-records?tracking_id=#{id}"
|
38
|
+
|
39
|
+
begin
|
40
|
+
|
41
|
+
record = HTTParty.get(url, :headers =>{'X-UOW' => 'GUIDO-BOT'}, :timeout => 60 )
|
42
|
+
|
43
|
+
rescue Exception => e
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
if record.nil? or record.empty? or record.to_s.include? 'errors'
|
48
|
+
|
49
|
+
puts "Hubo un error al consultar el servicio de Fichas de RM con el ID: #{id}".on_red
|
50
|
+
else
|
51
|
+
|
52
|
+
record['modalities'].each do | x |
|
53
|
+
|
54
|
+
if id.include? "PAM"
|
55
|
+
|
56
|
+
pam_costs << x['adultCost'] * 1.05
|
57
|
+
|
58
|
+
else
|
59
|
+
|
60
|
+
costs << x['adultCost']
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
rambo_ref = '<A HREF="http://backoffice.despegar.com/ds-rambo/#!/group-records/edit/' + group['oid'] + '">Editar en RAMBO</A><br><br>'
|
68
|
+
|
69
|
+
if pam_costs.nil?
|
70
|
+
|
71
|
+
@report << group['name'] + '<br>OID: ' + group['oid'] + '<br>Destino: ' + group['destination'] + '<br>Tracking IDs:' + group['trackingIds'] + '(Actividad/es de PAM sin disponibilidad)'
|
72
|
+
end
|
73
|
+
|
74
|
+
if !pam_costs.max.nil? && !costs.max.nil?
|
75
|
+
|
76
|
+
if pam_costs.max > costs.max
|
77
|
+
|
78
|
+
@report << group['name'].to_s + '<br>OID: ' + group['oid'] + '<br>Destino: ' + group['destination'] + '<br>Tracking IDs:' + group['trackingIds'].to_s + '<br>' + rambo_ref
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if !@report.empty?
|
85
|
+
|
86
|
+
resultado = true
|
87
|
+
end
|
88
|
+
|
89
|
+
resultado
|
90
|
+
end
|
91
|
+
|
92
|
+
report_size = @report.size.to_s
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
def alerta_group_records
|
98
|
+
|
99
|
+
#Genera y envía un e-mail de alerta listando los grupos de fichas con orden automático que tengan al menos una actividad de PAM pero el ganador con mejor costo sea de otro proveedor.
|
100
|
+
|
101
|
+
body_template = "<br><h1># Servicio de alerta de Grupos de Fichas para mejora de costos PAM: #</h1><br><b>
|
102
|
+
* Fueron consultados #{@groups_size} Grupos de Fichas.<br>
|
103
|
+
* Aplicaron a este reporte: #{@report_size}</b><br><br>
|
104
|
+
Los siguientes Grupos de Fichas contienen actividades de PAM que pierden competencia de costos con actividades de otro proveedor:<ul>"
|
105
|
+
|
106
|
+
@report.each do | item |
|
107
|
+
body_template = body_template + '<li>' + item.to_s + '</li>'
|
108
|
+
end
|
109
|
+
|
110
|
+
body_template = body_template + '</ul>' + '<br><br><br><br><br><h3>Para administrar los Grupos de Fichas dirigirse a DS-RAMBO:</h3><br>
|
111
|
+
<a href="http://backoffice.despegar.com/ds-rambo/login">
|
112
|
+
<img src="http://www.despegar.com/media/pictures/dcba67fc-0775-48d9-b00d-27b8f296af43" alt="Mountain View" style="width:320px;height:85px;">
|
113
|
+
</a><br><br><br><br><br>
|
114
|
+
-Reporte automatizado de DS-QA<br>
|
115
|
+
Dudas o consultas: ds-qa@despegar.com'
|
116
|
+
|
117
|
+
mail = Mail.new do
|
118
|
+
from 'ds.test.alert@gmail.com'
|
119
|
+
to 'ds-pam@despegar.com, nmelano@despgar.com asaffer@despegar.com, rramires@despegar.com, mviera@despegar.com, vrico@despegar.com'
|
120
|
+
subject '[Alerta] Grupos de Fichas con actividades PAM sin mejor costo - DS Automation'
|
121
|
+
|
122
|
+
html_part do
|
123
|
+
content_type 'text/html; charset=UTF-8'
|
124
|
+
body body_template
|
125
|
+
end
|
126
|
+
end
|
127
|
+
mail.deliver!
|
128
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
#language: es
|
3
|
+
Dado(/^que invoco al servicio de Grupos de Fichas de RM$/) do
|
4
|
+
rm_group_records
|
5
|
+
end
|
6
|
+
|
7
|
+
Entonces(/^checkeo aquellos grupos con orden Automatico que contengan actividades de PAM y en la competencia de costos gane alguna otra actividad de otro proveedor$/) do
|
8
|
+
|
9
|
+
if checkear_orden == true
|
10
|
+
alerta_group_records
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"tasks":["rm_group_records_costs_order"]}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ds_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DS QA
|
@@ -185,7 +185,6 @@ executables: []
|
|
185
185
|
extensions: []
|
186
186
|
extra_rdoc_files: []
|
187
187
|
files:
|
188
|
-
- ".bashrc"
|
189
188
|
- ".gitignore"
|
190
189
|
- ".henry/reports/html/2015-08-11T181012_quotamedia.html"
|
191
190
|
- ".henry/reports/html/2015-08-13T161030_quota_media.html"
|
@@ -205,18 +204,22 @@ files:
|
|
205
204
|
- ds_test.gemspec
|
206
205
|
- features/PAMFailedBookings.feature
|
207
206
|
- features/RMBundleStatus.feature
|
207
|
+
- features/RMgroupRecordsCostsOrder.feature
|
208
208
|
- features/methods/PAMFailedBookings_actions.rb
|
209
209
|
- features/methods/RMbundleStatus.rb
|
210
|
+
- features/methods/RMgroupRecordsCostsOrder.rb
|
210
211
|
- features/methods/actions_media.rb
|
211
212
|
- features/quotamedia.feature
|
212
213
|
- features/step_definitions/PAMFailedBookings_steps.rb
|
213
214
|
- features/step_definitions/RMbundleStatus.rb
|
215
|
+
- features/step_definitions/RMgroupRecordsCostsOrder.rb
|
214
216
|
- features/step_definitions/quotamedia.rb
|
215
217
|
- features/support/env.rb
|
216
218
|
- henry-context.yml
|
217
219
|
- hints.henry.pamfailedbookings
|
218
220
|
- hints.henry.quotamedia
|
219
221
|
- hints.henry.rmbundlestatus
|
222
|
+
- hints.henry.rmgrouprecordscostsorder
|
220
223
|
- in.henry
|
221
224
|
- log/PAMFailedBookings250920151127.html
|
222
225
|
- log/PAMFailedBookings250920151128.html
|
@@ -248,11 +251,14 @@ summary: Test automatizados
|
|
248
251
|
test_files:
|
249
252
|
- features/PAMFailedBookings.feature
|
250
253
|
- features/RMBundleStatus.feature
|
254
|
+
- features/RMgroupRecordsCostsOrder.feature
|
251
255
|
- features/methods/PAMFailedBookings_actions.rb
|
252
256
|
- features/methods/RMbundleStatus.rb
|
257
|
+
- features/methods/RMgroupRecordsCostsOrder.rb
|
253
258
|
- features/methods/actions_media.rb
|
254
259
|
- features/quotamedia.feature
|
255
260
|
- features/step_definitions/PAMFailedBookings_steps.rb
|
256
261
|
- features/step_definitions/RMbundleStatus.rb
|
262
|
+
- features/step_definitions/RMgroupRecordsCostsOrder.rb
|
257
263
|
- features/step_definitions/quotamedia.rb
|
258
264
|
- features/support/env.rb
|
data/.bashrc
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
2
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
3
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
4
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
5
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
6
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
7
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
8
|
-
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|