Revision 90c98ce4
Ajout d'un test unitaire pour le ticket #732.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@7273 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/tests/functional/plugins/test_plugin_hls.py | ||
---|---|---|
205 | 205 |
plugin_data = resp.lxml.xpath('//table[@class="vigitable"]' |
206 | 206 |
'/tbody/tr/td[@class="plugin_hls"]/a/text()') |
207 | 207 |
assert_equal(plugin_data[0].strip(), "2") |
208 |
|
|
209 |
def test_same_hls_impacted_twice(self): |
|
210 |
""" |
|
211 |
Pas de doublons dans les HLS impactés. |
|
212 |
Ticket #732. |
|
213 |
""" |
|
214 |
|
|
215 |
# On peuple la base de données avant le test. |
|
216 |
DBSession.add(self.aggregate) |
|
217 |
hls = HighLevelService( |
|
218 |
servicename = u'HLS', |
|
219 |
message = u'Bar', |
|
220 |
warning_threshold = 60, |
|
221 |
critical_threshold = 80, |
|
222 |
weight = None, |
|
223 |
priority = 2, |
|
224 |
) |
|
225 |
DBSession.add(hls) |
|
226 |
DBSession.flush() |
|
227 |
path1 = ImpactedPath(idsupitem = self.aggregate.events[0].idsupitem) |
|
228 |
DBSession.add(path1) |
|
229 |
path2 = ImpactedPath(idsupitem = self.aggregate.events[0].idsupitem) |
|
230 |
DBSession.add(path2) |
|
231 |
DBSession.flush() |
|
232 |
DBSession.add( |
|
233 |
ImpactedHLS( |
|
234 |
path = path1, |
|
235 |
hls = hls, |
|
236 |
distance = 1, |
|
237 |
) |
|
238 |
) |
|
239 |
DBSession.add( |
|
240 |
ImpactedHLS( |
|
241 |
path = path2, |
|
242 |
hls = hls, |
|
243 |
distance = 2, |
|
244 |
) |
|
245 |
) |
|
246 |
DBSession.flush() |
|
247 |
transaction.commit() |
|
248 |
DBSession.add(self.aggregate) |
|
249 |
|
|
250 |
# On accède à la page principale de VigiBoard |
|
251 |
resp = self.app.post( |
|
252 |
'/', extra_environ={'REMOTE_USER': 'access'}) |
|
253 |
|
|
254 |
# On s'assure que la colonne des HLS contient bien |
|
255 |
# le nom de notre HLS de plus haut niveau impacté. |
|
256 |
plugin_data = resp.lxml.xpath('//table[@class="vigitable"]' |
|
257 |
'/tbody/tr/td[@class="plugin_hls"]/text()') |
|
258 |
assert_equal(plugin_data[0].strip(), "HLS") |
Also available in: Unified diff