Module: check_mk
Branch: master
Commit: 553306cb99072ca374da36d5b87981f30d624d36
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=553306cb99072c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 8 16:36:18 2015 +0100
GUI-Tests: fix dependency on dynamic selection ids
---
web/guitest/wato.mk | 2 +-
web/htdocs/guitester.py | 26 ++++++++++++++++++++++++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/web/guitest/wato.mk b/web/guitest/wato.mk
index 3088f07..3ee6047 100644
--- a/web/guitest/wato.mk
+++ b/web/guitest/wato.mk
@@ -253,7 +253,7 @@
'variables': {'_change_alias': 'on',
'_change_ipaddress': 'on',
'_change_parents': 'on',
- '_transid': 'invalid',
+ '_transid': 'valid',
'attr_alias': 'Der L\xc3\xb6k\xc3\xa4le R\xc3\xb6chner',
'attr_display_ipaddress': '1',
'attr_display_ipv6address': '0',
diff --git a/web/htdocs/guitester.py b/web/htdocs/guitester.py
index fe498c8..804d3b3 100644
--- a/web/htdocs/guitester.py
+++ b/web/htdocs/guitester.py
@@ -190,12 +190,34 @@ def guitest_check_single_value(reference, reality):
def guitest_check_element_list(reference, reality):
errors = []
+ one_missing = False
for entry in reference:
- if entry not in reality:
+ if not guitest_entry_in_reference_list(entry, reality):
errors.append("missing entry %r" % (entry,))
+ one_missing = True
+ if one_missing:
+ for entry in reality:
+ if not guitest_entry_in_reference_list(entry, reference):
+ errors.append("exceeding entry %r" % (entry,))
return errors
+def guitest_entry_in_reference_list(entry, ref_list):
+ for ref_entry in ref_list:
+ if guitest_entries_match(ref_entry, entry):
+ return True
+ return False
+
+
+def guitest_entries_match(ref, real):
+ if type(ref) in (list, tuple):
+ return len(ref) == len(real) and \
+ map(guitest_drop_dynamic_ids, ref) == map(guitest_drop_dynamic_ids, real)
+ else:
+ return guitest_drop_dynamic_ids(ref) == guitest_drop_dynamic_ids(real)
+
+
+
def guitest_check_datatables(reference, reality):
if len(reference) != len(reality):
return [ _("Expected %d data tables, but got %d") % (len(reference),
len(reality)) ]
@@ -254,5 +276,5 @@ def find_common_prefix(a, b):
def guitest_drop_dynamic_ids(text):
- return re.sub("selection=[a-f0-9---]{36}", "selection=*",
+ return re.sub("selection(%3d|=)[a-f0-9---]{36}", "selection=*",
re.sub("_transid=1[4-6][0-9]{8}/[0-9]+",
"_transid=TRANSID", text))