Module: check_mk
Branch: master
Commit: cbe4254bd5fe18f3a4ea284d5ed17ca649fd7081
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cbe4254bd5fe18…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Dec 10 16:33:30 2018 +0100
Use table.open_table() instead of the Table constructor.
Change-Id: Idf0f95b3ab89dd6c8df45aa1cc541e6d85436c12
---
tests/unit/cmk/gui/test_table.py | 58 ++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 32 deletions(-)
diff --git a/tests/unit/cmk/gui/test_table.py b/tests/unit/cmk/gui/test_table.py
index 3fa632d..9f61f9f 100644
--- a/tests/unit/cmk/gui/test_table.py
+++ b/tests/unit/cmk/gui/test_table.py
@@ -8,7 +8,6 @@ import six
from cmk.gui.i18n import _
import cmk.gui.table as table
-from cmk.gui.table import Table
from cmk.gui.globals import html
from tools import compare_html
@@ -43,14 +42,13 @@ def test_basic(register_builtin_html):
table_id = 0
title = " TEST "
- table = Table(table_id, title, searchable=False, sortable=False)
- table.row()
- table.cell("A", "1")
- table.cell("B", "2")
- table.row()
- table.cell("A", "1")
- table.cell("C", "4")
- table.end()
+ with table.open_table(table_id, title, searchable=False, sortable=False):
+ table.row()
+ table.cell("A", "1")
+ table.cell("B", "2")
+ table.row()
+ table.cell("A", "1")
+ table.cell("C", "4")
written_text = "".join(html.response.flush_output())
assert read_out_simple_table(written_text) == [[u'A', u'B'],
[u'1', u'2'], [u'1', u'4']]
@@ -60,18 +58,17 @@ def test_plug(register_builtin_html):
table_id = 0
title = " TEST "
- table = Table(table_id, title, searchable=False, sortable=False)
- table.row()
- table.cell("A", "1")
- html.write("a")
- table.cell("B", "2")
- html.write("b")
- table.row()
- table.cell("A", "1")
- html.write("a")
- table.cell("C", "4")
- html.write("c")
- table.end()
+ with table.open_table(table_id, title, searchable=False, sortable=False):
+ table.row()
+ table.cell("A", "1")
+ html.write("a")
+ table.cell("B", "2")
+ html.write("b")
+ table.row()
+ table.cell("A", "1")
+ html.write("a")
+ table.cell("C", "4")
+ html.write("c")
written_text = "".join(html.response.flush_output())
assert read_out_simple_table(written_text) == [[u'A', u'B'],
[u'1a', u'2b'], [u'1a', u'4c']]
@@ -99,18 +96,15 @@ def test_nesting(register_builtin_html):
table_id = 0
title = " TEST "
- table = Table(table_id, title, searchable=False, sortable=False)
- table.row()
- table.cell("A", "1")
- table.cell("B", "")
-
- t2 = Table(table_id+1, title+"2", searchable=False, sortable=False)
- t2.row()
- t2.cell("_", "+")
- t2.cell("|", "-")
- t2.end()
+ with table.open_table(table_id, title, searchable=False, sortable=False):
+ table.row()
+ table.cell("A", "1")
+ table.cell("B", "")
+ with table.open_table(table_id+1, title+"2", searchable=False,
sortable=False):
+ table.row()
+ table.cell("_", "+")
+ table.cell("|", "-")
- table.end()
written_text = "".join(html.response.flush_output())
assert compare_html(written_text, '''<h3> TEST </h3>
<script
type="text/javascript">\nupdate_headinfo(\'1
row\');\n</script>