Skip to content

Commit

Permalink
Add Unit Test for Problems search QLineEdit
Browse files Browse the repository at this point in the history
Ref #272
  • Loading branch information
algorys committed Mar 15, 2018
1 parent c990200 commit b95c2c6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/test_problems_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_update_problems_data(self):

# Even if a filter is given,
# the view does not filter by item type if filter buttons are False
under_test.update_problems_data('host')
under_test.update_problems_data('service')

# Collect items
items_test = [
Expand All @@ -178,6 +178,24 @@ def test_update_problems_data(self):

self.assertEqual(20, len(items_test))

def test_update_problems_data_keep_linesearch_text(self):
"""Update Problems Data Keep LineSearch Text"""

under_test = ProblemsQWidget()
spy_widget_test = SpyQWidget()
spy_widget_test.initialize()
under_test.initialize(None)

self.assertFalse(under_test.line_search.text())

# Set text of QLineEdit
under_test.line_search.setText('research')

under_test.update_problems_data()

# After update, text is keeped
self.assertEqual('research', under_test.line_search.text())

def test_filter_hosts(self):
"""Filter Hosts in Problems View"""

Expand Down

0 comments on commit b95c2c6

Please sign in to comment.