[tests/config] Add tests for helptexts

Ensure that each theme is listed in the helptext and that there is a
helptext entry for every module.
This commit is contained in:
Tobi-wan Kenobi 2016-12-17 08:42:23 +01:00
parent 4f7666533c
commit 9a350ddc2a
2 changed files with 26 additions and 1 deletions

View file

@ -1,7 +1,15 @@
# pylint: disable=C0103,C0111
import unittest
import mock
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from bumblebee.config import Config
from bumblebee.theme import themes
from bumblebee.engine import all_modules
class TestConfig(unittest.TestCase):
def setUp(self):
@ -25,4 +33,20 @@ class TestConfig(unittest.TestCase):
"name": x.split(":")[1],
} for x in self.someAliasModules])
@mock.patch("sys.stdout", new_callable=StringIO)
@mock.patch("sys.exit")
def test_list_themes(self, exit, stdout):
cfg = Config(["-l", "themes"])
result = stdout.getvalue()
for theme in themes():
self.assertTrue(theme in result)
@mock.patch("sys.stdout", new_callable=StringIO)
@mock.patch("sys.exit")
def test_list_modules(self, exit, stdout):
cfg = Config(["-l", "modules"])
result = stdout.getvalue()
for module in all_modules():
self.assertTrue(module["name"] in result)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4