Module: check_mk
Branch: master
Commit: 05ac37978940fc0751b0978a316851d8f1f6b4bc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=05ac37978940fc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 23 11:01:12 2016 +0200
Added test checking for left html.debug() calls
---
tests/web/test_find_debug_code.py | 21 +++++++++++++++++++++
web/htdocs/views.py | 2 --
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/tests/web/test_find_debug_code.py b/tests/web/test_find_debug_code.py
new file mode 100644
index 0000000..a810b66
--- /dev/null
+++ b/tests/web/test_find_debug_code.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+# encoding: utf-8
+
+import os
+import glob
+from testlib import cmk_path, cmc_path
+
+def test_find_debug_code():
+ scanned = 0
+ for base_path in [ cmk_path(), cmc_path() ]:
+ for dirpath, dirnames, filenames in os.walk("%s/web" % base_path):
+ scanned += 1
+ for filename in filenames:
+ path = "%s/%s" % (dirpath, filename)
+
+ for line in open(path):
+ l = line.lstrip()
+ assert not l.startswith("html.debug("), \
+ "Found \"html.debug(...)\" call"
+
+ assert scanned > 0
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 2affdd5..7a107b8 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1489,9 +1489,7 @@ def play_alarm_sounds():
if not url.endswith("/"):
url += "/"
- html.debug(g_alarm_sound_states)
for state_name, wav in config.sounds:
- html.debug(state_name)
if not state_name or state_name in g_alarm_sound_states:
html.play_sound(url + wav)
break # only one sound at one time