Anna Schumaker
ea2913429c
The MessagesView combines two MessageViews into a split-pane card. This lets us display stdout and stderr side-by-side to the user so they can see what is going on. I also add a 'back' button that the user can click to signal that they are done reviewing the output. Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
541 lines
23 KiB
Python
541 lines
23 KiB
Python
# Copyright 2023 (c) Anna Schumaker.
|
|
"""Tests our TestCaseView for displaying xfstests results."""
|
|
import unittest
|
|
import tests.xunit
|
|
import xfstestsdb.gtk.view
|
|
from gi.repository import Gtk
|
|
from gi.repository import Adw
|
|
|
|
|
|
class TestXunitView(unittest.TestCase):
|
|
"""Tests the XunitView base class."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.xfstestsdb = xfstestsdb.Command()
|
|
with unittest.mock.patch("sys.stdout"):
|
|
self.xfstestsdb.run(["new", "/dev/vda1"])
|
|
self.xfstestsdb.run(["xunit", "read", "--name", "xunit-1",
|
|
"1", str(tests.xunit.XUNIT_1)])
|
|
self.xfstestsdb.run(["xunit", "read", "--name", "xunit-2",
|
|
"1", str(tests.xunit.XUNIT_1)])
|
|
|
|
self.model = xfstestsdb.gtk.model.XunitList(self.xfstestsdb.sql, 1)
|
|
self.view = xfstestsdb.gtk.view.XunitView("title")
|
|
|
|
def test_init(self):
|
|
"""Test that we created the XunitView correctly."""
|
|
self.assertIsInstance(self.view, Gtk.ScrolledWindow)
|
|
self.assertTrue(self.view.has_css_class("card"))
|
|
|
|
def test_columnview(self):
|
|
"""Test that we set up the ColumnView child correctly."""
|
|
self.assertIsInstance(self.view.props.child, Gtk.ColumnView)
|
|
self.assertIsInstance(self.view.props.child.get_model(),
|
|
Gtk.NoSelection)
|
|
self.assertEqual(len(self.view.props.child.get_columns()), 0)
|
|
self.assertTrue(self.view.props.child.get_show_column_separators())
|
|
self.assertTrue(self.view.props.child.get_show_row_separators())
|
|
self.assertTrue(self.view.props.child.get_hexpand())
|
|
|
|
def test_filtermodel(self):
|
|
"""Test that we set up the Gtk.FilterModel correctly."""
|
|
self.assertIsInstance(self.view.filtermodel, Gtk.FilterListModel)
|
|
self.assertIsNone(self.view.filtermodel.props.filter)
|
|
|
|
self.assertEqual(self.view.props.child.get_model().get_model(),
|
|
self.view.filtermodel)
|
|
|
|
def test_firstcol(self):
|
|
"""Test that we set up the first column correctly."""
|
|
self.assertIsInstance(self.view.firstcol, Gtk.ColumnViewColumn)
|
|
self.assertIsInstance(self.view.firstcol.props.factory,
|
|
xfstestsdb.gtk.row.LabelFactory)
|
|
self.assertEqual(self.view.firstcol.props.factory.property, "name")
|
|
self.assertEqual(self.view.firstcol.props.title, "title")
|
|
self.assertFalse(self.view.firstcol.props.expand)
|
|
|
|
def test_model(self):
|
|
"""Test the model property."""
|
|
columns = self.view.props.child.get_columns()
|
|
self.assertIsNone(self.view.model)
|
|
self.assertEqual(len(columns), 0)
|
|
|
|
self.view.model = self.model
|
|
self.assertEqual(self.view.filtermodel.props.model, self.model)
|
|
self.assertEqual(len(columns), 3)
|
|
self.assertEqual(columns[0], self.view.firstcol)
|
|
|
|
for i, title in enumerate(["xunit-1", "xunit-2"], start=1):
|
|
with self.subTest(i=i, title=title):
|
|
self.assertIsInstance(columns[i].props.factory,
|
|
xfstestsdb.gtk.row.XunitFactory)
|
|
self.assertEqual(columns[i].props.factory.xunit, title)
|
|
self.assertEqual(columns[i].props.title, title)
|
|
self.assertTrue(columns[i].props.expand)
|
|
|
|
self.view.model = None
|
|
self.assertEqual(len(columns), 0)
|
|
|
|
|
|
class EnvironmentView(unittest.TestCase):
|
|
"""Tests the EnvironmentView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.xfstestsdb = xfstestsdb.Command()
|
|
with unittest.mock.patch("sys.stdout"):
|
|
self.xfstestsdb.run(["new", "/dev/vda1"])
|
|
self.xfstestsdb.run(["xunit", "read", "--name", "xunit-1",
|
|
"1", str(tests.xunit.XUNIT_1)])
|
|
self.xfstestsdb.run(["xunit", "read", "--name", "xunit-2",
|
|
"1", str(tests.xunit.XUNIT_1)])
|
|
|
|
self.props = xfstestsdb.gtk.model.PropertyList(self.xfstestsdb.sql, 1)
|
|
self.model = self.props.environment
|
|
self.view = xfstestsdb.gtk.view.EnvironmentView()
|
|
|
|
def test_init(self):
|
|
"""Test that we created the EnvironmentView correctly."""
|
|
self.assertIsInstance(self.view, xfstestsdb.gtk.view.XunitView)
|
|
self.assertIsNone(self.view.filtermodel.props.filter)
|
|
self.assertIsNone(self.view.firstcol)
|
|
self.assertIsNone(self.view.model)
|
|
|
|
self.assertTrue(self.view.props.child.has_css_class("data-table"))
|
|
|
|
def test_make_factory(self):
|
|
"""Test the do_make_factory() implementation."""
|
|
factory = self.view.do_make_factory("property")
|
|
self.assertIsInstance(factory, xfstestsdb.gtk.row.EnvironmentFactory)
|
|
self.assertEqual(factory.property, "property")
|
|
|
|
def test_model(self):
|
|
"""Test the model property."""
|
|
columns = self.view.props.child.get_columns()
|
|
self.assertIsNone(self.view.model)
|
|
self.assertEqual(len(columns), 0)
|
|
self.assertFalse(self.view.props.visible)
|
|
|
|
self.view.model = self.model
|
|
self.assertEqual(self.view.filtermodel.props.model, self.model)
|
|
self.assertEqual(len(columns), 7)
|
|
self.assertTrue(self.view.props.visible)
|
|
|
|
self.view.model = None
|
|
self.assertEqual(len(columns), 0)
|
|
self.assertFalse(self.view.props.visible)
|
|
|
|
|
|
class TestPropertyView(unittest.TestCase):
|
|
"""Tests the PropertyView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.view = xfstestsdb.gtk.view.PropertyView()
|
|
|
|
def test_init(self):
|
|
"""Test that we created the ProeprtyView correctly."""
|
|
self.assertIsInstance(self.view, xfstestsdb.gtk.view.XunitView)
|
|
self.assertIsInstance(self.view.filtermodel.props.filter,
|
|
xfstestsdb.gtk.model.PropertyFilter)
|
|
self.assertIsNone(self.view.model)
|
|
|
|
self.assertEqual(self.view.props.vscrollbar_policy,
|
|
Gtk.PolicyType.NEVER)
|
|
self.assertEqual(self.view.firstcol.props.title, "property")
|
|
self.assertTrue(self.view.props.child.has_css_class("data-table"))
|
|
|
|
def test_make_factory(self):
|
|
"""Test the do_make_factory() implementation."""
|
|
factory = self.view.do_make_factory("xunit-1")
|
|
self.assertIsInstance(factory, xfstestsdb.gtk.row.PropertyFactory)
|
|
self.assertEqual(factory.xunit, "xunit-1")
|
|
|
|
|
|
class TestFilterButtons(unittest.TestCase):
|
|
"""Test case for our TestCaseView FilterButtons."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.buttons = xfstestsdb.gtk.view.FilterButtons()
|
|
|
|
def test_init(self):
|
|
"""Check that the buttons were created correctly."""
|
|
self.assertIsInstance(self.buttons, Gtk.Box)
|
|
self.assertTrue(self.buttons.has_css_class("linked"))
|
|
|
|
def test_passed_button(self):
|
|
"""Test the 'passed' button."""
|
|
self.assertIsInstance(self.buttons._passed,
|
|
xfstestsdb.gtk.button.StatusToggle)
|
|
self.assertEqual(self.buttons.get_first_child(), self.buttons._passed)
|
|
|
|
self.assertEqual(self.buttons._passed.props.icon_name, "test-pass")
|
|
self.assertTrue(self.buttons._passed.has_css_class("passed"))
|
|
self.assertFalse(self.buttons._passed.props.active)
|
|
|
|
self.assertFalse(self.buttons.passed)
|
|
self.buttons._passed.props.active = True
|
|
self.assertTrue(self.buttons.passed)
|
|
|
|
def test_skipped_button(self):
|
|
"""Test the 'skipped' button."""
|
|
self.assertIsInstance(self.buttons._skipped,
|
|
xfstestsdb.gtk.button.StatusToggle)
|
|
self.assertEqual(self.buttons._passed.get_next_sibling(),
|
|
self.buttons._skipped)
|
|
|
|
self.assertEqual(self.buttons._skipped.props.icon_name, "test-skip")
|
|
self.assertTrue(self.buttons._skipped.has_css_class("skipped"))
|
|
self.assertFalse(self.buttons._skipped.props.active)
|
|
|
|
self.assertFalse(self.buttons.skipped)
|
|
self.buttons._skipped.props.active = True
|
|
self.assertTrue(self.buttons.skipped)
|
|
|
|
def test_failure_button(self):
|
|
"""Test the 'failure' button."""
|
|
self.assertIsInstance(self.buttons._failure,
|
|
xfstestsdb.gtk.button.StatusToggle)
|
|
self.assertEqual(self.buttons._skipped.get_next_sibling(),
|
|
self.buttons._failure)
|
|
|
|
self.assertEqual(self.buttons._failure.props.icon_name, "test-fail")
|
|
self.assertTrue(self.buttons._failure.has_css_class("failure"))
|
|
self.assertTrue(self.buttons._failure.props.active)
|
|
|
|
self.assertTrue(self.buttons.failure)
|
|
self.buttons._failure.props.active = False
|
|
self.assertFalse(self.buttons.failure)
|
|
|
|
|
|
class TestTestCaseView(unittest.TestCase):
|
|
"""Tests the TestCaseView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.view = xfstestsdb.gtk.view.TestCaseView()
|
|
|
|
def test_init(self):
|
|
"""Test that we create the TestCaseView correctly."""
|
|
self.assertIsInstance(self.view, xfstestsdb.gtk.view.XunitView)
|
|
self.assertIsInstance(self.view.filtermodel.props.filter,
|
|
xfstestsdb.gtk.model.TestCaseFilter)
|
|
self.assertIsNone(self.view.model)
|
|
|
|
self.assertEqual(self.view.firstcol.props.title, "testcase")
|
|
self.assertTrue(self.view.props.child.get_vexpand())
|
|
|
|
def test_filter(self):
|
|
"""Test that we set up the Gtk.FilterModel and Buttons correctly."""
|
|
self.assertIsInstance(self.view.filterbuttons,
|
|
xfstestsdb.gtk.view.FilterButtons)
|
|
|
|
self.assertFalse(self.view.filtermodel.props.filter.passed)
|
|
self.view.filterbuttons.passed = True
|
|
self.assertTrue(self.view.filtermodel.props.filter.passed)
|
|
|
|
self.assertFalse(self.view.filtermodel.props.filter.skipped)
|
|
self.view.filterbuttons.skipped = True
|
|
self.assertTrue(self.view.filtermodel.props.filter.skipped)
|
|
|
|
self.assertTrue(self.view.filtermodel.props.filter.failure)
|
|
self.view.filterbuttons.failure = False
|
|
self.assertFalse(self.view.filtermodel.props.filter.failure)
|
|
|
|
def test_make_factory(self):
|
|
"""Test the do_make_factory() implementation."""
|
|
show_messages = unittest.mock.Mock()
|
|
self.view.connect("show-messages", show_messages)
|
|
|
|
factory = self.view.do_make_factory("xunit-1")
|
|
self.assertIsInstance(factory, xfstestsdb.gtk.row.ResultFactory)
|
|
self.assertEqual(factory.xunit, "xunit-1")
|
|
|
|
factory.emit("show-messages", "testcase", "xunit", "stdout", "stderr")
|
|
show_messages.assert_called_with(self.view, "testcase", "xunit",
|
|
"stdout", "stderr")
|
|
|
|
|
|
class TestMessageView(unittest.TestCase):
|
|
"""Test the MessageView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.view = xfstestsdb.gtk.view.MessageView("title")
|
|
|
|
def test_init(self):
|
|
"""Check that the MessageView was set up correctly."""
|
|
self.assertIsInstance(self.view, Gtk.Box)
|
|
self.assertEqual(self.view.props.orientation, Gtk.Orientation.VERTICAL)
|
|
self.assertTrue(self.view.has_css_class("view"))
|
|
|
|
def test_detect_diff(self):
|
|
"""Check detecting if input test looks like a diff."""
|
|
self.assertFalse(self.view.detect_diff("not a diff"))
|
|
lines = ["+++ /some/file"]
|
|
self.assertFalse(self.view.detect_diff("\n".join(lines)))
|
|
lines.append("--- /some/other/file")
|
|
self.assertFalse(self.view.detect_diff("\n".join(lines)))
|
|
lines.append("@@ 12,34,5 @@")
|
|
self.assertFalse(self.view.detect_diff("\n".join(lines)))
|
|
lines.append(" some context line")
|
|
self.assertTrue(self.view.detect_diff("\n".join(lines)))
|
|
lines[-1] = "+an added line"
|
|
self.assertTrue(self.view.detect_diff("\n".join(lines)))
|
|
lines[-1] = "-a removed line"
|
|
self.assertTrue(self.view.detect_diff("\n".join(lines)))
|
|
|
|
def test_markup_diff(self):
|
|
"""Check colorizing lines with diff colors."""
|
|
self.assertEqual(self.view.markup_diff("abcde"), "abcde")
|
|
self.assertEqual(self.view.markup_diff("+++ /some/file"),
|
|
"<span color='#26a269'>+++ /some/file</span>")
|
|
self.assertEqual(self.view.markup_diff("--- /some/other/file"),
|
|
"<span color='#c01c28'>--- /some/other/file</span>")
|
|
self.assertEqual(self.view.markup_diff("@@ 12,34,5 @@"),
|
|
"<span color='#1c71d8'>@@ 12,34,5 @@</span>")
|
|
self.assertEqual(self.view.markup_diff(" a context line"),
|
|
"<span color='#77767b'> a context line</span>")
|
|
self.assertEqual(self.view.markup_diff("+an added line"),
|
|
"<span color='#26a269'>+an added line</span>")
|
|
self.assertEqual(self.view.markup_diff("-a removed line"),
|
|
"<span color='#c01c28'>-a removed line</span>")
|
|
|
|
def test_title(self):
|
|
"""Test the title widgets."""
|
|
self.assertIsInstance(self.view._label, Gtk.Label)
|
|
self.assertIsInstance(self.view._label.get_next_sibling(),
|
|
Gtk.Separator)
|
|
self.assertEqual(self.view.get_first_child(), self.view._label)
|
|
|
|
self.assertEqual(self.view.title, "title")
|
|
self.assertEqual(self.view._label.props.label, "title")
|
|
self.assertEqual(self.view._label.props.margin_top, 6)
|
|
self.assertTrue(self.view._label.has_css_class("large-title"))
|
|
|
|
def test_text(self):
|
|
"""Test the text property."""
|
|
win = self.view.get_last_child()
|
|
self.assertIsInstance(win, Gtk.ScrolledWindow)
|
|
self.assertIsInstance(self.view._textview, Gtk.TextView)
|
|
self.assertEqual(win.props.child, self.view._textview)
|
|
self.assertTrue(win.props.vexpand)
|
|
|
|
self.assertFalse(self.view._textview.props.editable)
|
|
self.assertTrue(self.view._textview.props.monospace)
|
|
|
|
buffer = self.view._textview.get_buffer()
|
|
self.assertEqual(self.view.text, "")
|
|
with unittest.mock.patch.object(buffer, "set_text",
|
|
wraps=buffer.set_text) as mock_set:
|
|
self.view.text = "text"
|
|
self.assertEqual(buffer.get_text(buffer.get_start_iter(),
|
|
buffer.get_end_iter(), True),
|
|
"text")
|
|
mock_set.assert_called_with("text")
|
|
self.assertEqual(self.view.text, "text")
|
|
|
|
def test_text_diff(self):
|
|
"""Test setting the text property to a diff string."""
|
|
buffer = self.view._textview.get_buffer()
|
|
diff = ["+++ /some/file", "--- /some/other/file", "@@ 12,34,5 @@",
|
|
" context line", "-removed line", "+added line"]
|
|
|
|
with unittest.mock.patch.object(buffer, "set_text",
|
|
wraps=buffer.set_text) as mock_set:
|
|
self.view.text = "\n".join(diff)
|
|
mock_set.assert_not_called()
|
|
self.assertEqual(self.view.text, "\n".join(diff))
|
|
|
|
self.view.text = "\n".join(diff)
|
|
self.assertEqual(self.view.text, "\n".join(diff))
|
|
|
|
|
|
class MessagesView(unittest.TestCase):
|
|
"""Test the MessagesView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.view = xfstestsdb.gtk.view.MessagesView()
|
|
|
|
def test_init(self):
|
|
"""Check that the MessagesView was set up correctly."""
|
|
self.assertIsInstance(self.view, Gtk.Box)
|
|
self.assertIsInstance(self.view.get_first_child(), Gtk.CenterBox)
|
|
self.assertIsInstance(self.view.get_last_child(), Gtk.Paned)
|
|
|
|
self.assertTrue(self.view.get_first_child().has_css_class("toolbar"))
|
|
self.assertTrue(self.view.has_css_class("card"))
|
|
|
|
self.assertEqual(self.view.props.orientation, Gtk.Orientation.VERTICAL)
|
|
self.assertEqual(self.view.props.margin_start, 24)
|
|
self.assertEqual(self.view.props.margin_end, 24)
|
|
self.assertEqual(self.view.props.margin_top, 24)
|
|
self.assertEqual(self.view.props.margin_bottom, 24)
|
|
|
|
def test_back_button(self):
|
|
"""Check that the back button was set up correctly."""
|
|
self.assertIsInstance(self.view._back, Gtk.Button)
|
|
self.assertIsInstance(self.view._back.props.child, Adw.ButtonContent)
|
|
self.assertEqual(self.view.get_first_child().props.start_widget,
|
|
self.view._back)
|
|
|
|
self.assertEqual(self.view._back.props.child.props.icon_name,
|
|
"go-previous-symbolic")
|
|
self.assertEqual(self.view._back.props.child.props.label, "back")
|
|
self.assertTrue(self.view._back.has_css_class("suggested-action"))
|
|
self.assertTrue(self.view._back.has_css_class("pill"))
|
|
|
|
go_back = unittest.mock.Mock()
|
|
self.view.connect("go-back", go_back)
|
|
self.view._back.emit("clicked")
|
|
go_back.assert_called()
|
|
|
|
def test_title(self):
|
|
"""Check that the view title was set up correctly."""
|
|
self.assertIsInstance(self.view._title, Adw.WindowTitle)
|
|
self.assertEqual(self.view.get_first_child().props.center_widget,
|
|
self.view._title)
|
|
|
|
self.assertEqual(self.view.testcase, "")
|
|
self.view.testcase = "test/case"
|
|
self.assertEqual(self.view._title.props.title, "test/case")
|
|
|
|
self.assertEqual(self.view.xunit, "")
|
|
self.view.xunit = "xunit-1"
|
|
self.assertEqual(self.view._title.props.subtitle, "xunit-1")
|
|
|
|
def test_stdout(self):
|
|
"""Check that the stdout window was set up properly."""
|
|
self.assertIsInstance(self.view._stdout,
|
|
xfstestsdb.gtk.view.MessageView)
|
|
self.assertEqual(self.view.get_last_child().props.start_child,
|
|
self.view._stdout)
|
|
self.assertEqual(self.view._stdout.title, "stdout")
|
|
|
|
self.assertEqual(self.view.stdout, "")
|
|
self.view.stdout = "stdout text"
|
|
self.assertEqual(self.view._stdout.text, "stdout text")
|
|
|
|
def test_stderr(self):
|
|
"""Check that the stderr window was set up properly."""
|
|
self.assertIsInstance(self.view._stderr,
|
|
xfstestsdb.gtk.view.MessageView)
|
|
self.assertEqual(self.view.get_last_child().props.end_child,
|
|
self.view._stderr)
|
|
self.assertEqual(self.view._stderr.title, "stderr")
|
|
|
|
self.assertEqual(self.view.stderr, "")
|
|
self.view.stderr = "stderr text"
|
|
self.assertEqual(self.view._stderr.text, "stderr text")
|
|
|
|
|
|
class TestSummaryView(unittest.TestCase):
|
|
"""Tests the SummaryView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.view = xfstestsdb.gtk.view.SummaryView()
|
|
|
|
def test_init(self):
|
|
"""Test that we created the SummaryView correctly."""
|
|
self.assertIsInstance(self.view, xfstestsdb.gtk.view.XunitView)
|
|
self.assertIsNone(self.view.filtermodel.props.filter)
|
|
self.assertIsNone(self.view.model)
|
|
|
|
self.assertEqual(self.view.props.vscrollbar_policy,
|
|
Gtk.PolicyType.NEVER)
|
|
self.assertEqual(self.view.firstcol.props.title, "summary")
|
|
self.assertTrue(self.view.props.child.has_css_class("data-table"))
|
|
|
|
def test_make_factory(self):
|
|
"""Test the do_make_factory() implementation."""
|
|
factory = self.view.do_make_factory("xunit-1")
|
|
self.assertIsInstance(factory, xfstestsdb.gtk.row.SummaryFactory)
|
|
self.assertEqual(factory.xunit, "xunit-1")
|
|
|
|
|
|
class TestXfstestsView(unittest.TestCase):
|
|
"""Test the XfstestsView."""
|
|
|
|
def setUp(self):
|
|
"""Set up common variables."""
|
|
self.xfstestsdb = xfstestsdb.Command()
|
|
with unittest.mock.patch("sys.stdout"):
|
|
self.xfstestsdb.run(["new", "/dev/vda1"])
|
|
self.xfstestsdb.run(["xunit", "read", "--name", "xunit-1",
|
|
"1", str(tests.xunit.XUNIT_1)])
|
|
self.xfstestsdb.run(["xunit", "read", "--name", "xunit-2",
|
|
"1", str(tests.xunit.XUNIT_1)])
|
|
|
|
self.props = xfstestsdb.gtk.model.PropertyList(self.xfstestsdb.sql, 1)
|
|
self.model = xfstestsdb.gtk.model.TestCaseList(self.xfstestsdb.sql, 1)
|
|
self.summary = xfstestsdb.gtk.model.SummaryList(self.xfstestsdb.sql, 1)
|
|
self.view = xfstestsdb.gtk.view.XfstestsView()
|
|
|
|
def test_init(self):
|
|
"""Check that the XfstestsView was set up correctly."""
|
|
self.assertIsInstance(self.view, Gtk.Box)
|
|
self.assertEqual(self.view.props.orientation, Gtk.Orientation.VERTICAL)
|
|
|
|
def test_environment_view(self):
|
|
"""Check that the XfstestsView sets up an EnvironmentView correctly."""
|
|
self.assertIsInstance(self.view._environview,
|
|
xfstestsdb.gtk.view.EnvironmentView)
|
|
self.assertEqual(self.view.get_first_child(), self.view._environview)
|
|
|
|
def test_property_view(self):
|
|
"""Check that the XfstestsView sets up a PropertyView correctly."""
|
|
sep = self.view._environview.get_next_sibling()
|
|
self.assertIsInstance(sep, Gtk.Separator)
|
|
self.assertIsInstance(self.view._propertyview,
|
|
xfstestsdb.gtk.view.PropertyView)
|
|
self.assertEqual(sep.get_next_sibling(), self.view._propertyview)
|
|
|
|
def test_testcase_view(self):
|
|
"""Check that the XfstestsView sets up a TestCaseView correctly."""
|
|
sep = self.view._propertyview.get_next_sibling()
|
|
self.assertIsInstance(sep, Gtk.Separator)
|
|
self.assertIsInstance(self.view._testcaseview,
|
|
xfstestsdb.gtk.view.TestCaseView)
|
|
self.assertEqual(sep.get_next_sibling(), self.view._testcaseview)
|
|
|
|
def test_summary_view(self):
|
|
"""Check that the XfstestsView sets up a SummaryView correctly."""
|
|
sep = self.view._testcaseview.get_next_sibling()
|
|
self.assertIsInstance(sep, Gtk.Separator)
|
|
self.assertIsInstance(self.view._summaryview,
|
|
xfstestsdb.gtk.view.SummaryView)
|
|
self.assertEqual(sep.get_next_sibling(), self.view._summaryview)
|
|
|
|
def test_environment(self):
|
|
"""Test the XfstestsView 'environment' property."""
|
|
self.assertIsNone(self.view.environment)
|
|
self.view.environment = self.props.environment
|
|
self.assertEqual(self.view._environview.model, self.props.environment)
|
|
|
|
def test_properties(self):
|
|
"""Test the XfstestsView 'properties' property."""
|
|
self.assertIsNone(self.view.properties)
|
|
self.view.properties = self.props
|
|
self.assertEqual(self.view._propertyview.model, self.props)
|
|
|
|
def test_model(self):
|
|
"""Test the XfstestsView 'model' property."""
|
|
self.assertIsNone(self.view.model)
|
|
self.view.model = self.model
|
|
self.assertEqual(self.view._testcaseview.model, self.model)
|
|
|
|
def test_summary(self):
|
|
"""Test the XfstestsView 'summary' property."""
|
|
self.assertIsNone(self.view.summary)
|
|
self.view.summary = self.summary
|
|
self.assertEqual(self.view._summaryview.model, self.summary)
|
|
|
|
def test_filterbuttons(self):
|
|
"""Test the XfstestsView 'filterbuttons' property."""
|
|
self.assertEqual(self.view.filterbuttons,
|
|
self.view._testcaseview.filterbuttons)
|