[tests/module] Test generation of error widget
When a module/widget throws, an error widget should be produced.
This commit is contained in:
parent
533b8ca0cc
commit
d19eb72296
1 changed files with 13 additions and 1 deletions
|
@ -7,6 +7,9 @@ import core.widget
|
|||
import core.config
|
||||
|
||||
class TestModule(core.module.Module):
|
||||
def update(self):
|
||||
if self.fail:
|
||||
raise Exception(self.error)
|
||||
pass
|
||||
|
||||
class module(unittest.TestCase):
|
||||
|
@ -68,4 +71,13 @@ class module(unittest.TestCase):
|
|||
module = TestModule(config=cfg)
|
||||
self.assertEqual(None, module.parameter('foo'))
|
||||
|
||||
def test_error_widget(self):
|
||||
cfg = core.config.Config([])
|
||||
module = TestModule(config=cfg)
|
||||
module.fail = True
|
||||
module.error = '!!'
|
||||
module.update_wrapper()
|
||||
self.assertEqual(1, len(module.widgets()))
|
||||
self.assertEqual('error: !!', module.widget().full_text())
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Reference in a new issue