Commit 93726c4a authored by Bram Schoenmakers's avatar Bram Schoenmakers

Fix color tests for garbage/empty values

The color functions now return a neutral/default color when
empty/garbage colors are entered in the configuration file.

This addresses issues #69 and #70.
parent 239a275f
...@@ -82,42 +82,34 @@ class ConfigTest(TopydoTest): ...@@ -82,42 +82,34 @@ class ConfigTest(TopydoTest):
self.assertEqual(config("test/data/ConfigTest4.conf").append_parent_contexts(), self.assertEqual(config("test/data/ConfigTest4.conf").append_parent_contexts(),
bool(int(config().defaults["dep"]["append_parent_contexts"]))) bool(int(config().defaults["dep"]["append_parent_contexts"])))
@skip("Error checking not yet implemented")
def test_config14(self): def test_config14(self):
""" Bad priority color value. """ """ Bad priority color value. """
self.assertEqual(config("test/data/ConfigTest4.conf").priority_colors(), self.assertEqual(config("test/data/ConfigTest4.conf").priority_color('A').color, 6)
config().defaults["colorscheme"]["priority_colors"]) self.assertEqual(config("test/data/ConfigTest4.conf").priority_color('B').color, 3)
self.assertEqual(config("test/data/ConfigTest4.conf").priority_color('C').color, 4)
@skip("Error checking not yet implemented")
def test_config15(self): def test_config15(self):
""" Bad project color value. """ """ Bad project color value. """
self.assertEqual(config("test/data/ConfigTest4.conf").project_color(), self.assertTrue(config("test/data/ConfigTest4.conf").project_color().is_neutral())
config().defaults["colorscheme"]["project_color"])
@skip("Error checking not yet implemented")
def test_config16(self): def test_config16(self):
""" Bad context color value. """ """ Bad context color value. """
self.assertEqual(config("test/data/ConfigTest4.conf").context_color(), self.assertTrue(config("test/data/ConfigTest4.conf").context_color().is_neutral())
config().defaults["colorscheme"]["context_color"])
@skip("Error checking not yet implemented")
def test_config17(self): def test_config17(self):
""" Bad metadata color value. """ """ Bad metadata color value. """
self.assertEqual(config("test/data/ConfigTest4.conf").metadata_color(), self.assertTrue(config("test/data/ConfigTest4.conf").metadata_color().is_neutral())
config().defaults["colorscheme"]["metadata_color"])
@skip("Error checking not yet implemented")
def test_config18(self): def test_config18(self):
""" Bad link color value. """ """ Bad link color value. """
self.assertEqual(config("test/data/ConfigTest4.conf").link_color(), self.assertTrue(config("test/data/ConfigTest4.conf").link_color().is_neutral())
config().defaults["colorscheme"]["link_color"])
@skip("Test not yet implemented")
# the test needs to be of the internal function _str_to_dict # the test needs to be of the internal function _str_to_dict
def test_config19(self): def test_config19(self):
""" No priority color value. """ """ No priority color value. """
self.assertEqual(config("test/data/ConfigTest4.conf").priority_colors(), self.assertEqual(config("test/data/ConfigTest4.conf").priority_color('A').color, 6)
config().defaults["colorscheme"]["priority_colors"]) self.assertEqual(config("test/data/ConfigTest4.conf").priority_color('B').color, 3)
self.assertEqual(config("test/data/ConfigTest4.conf").priority_color('C').color, 4)
def test_config20(self): def test_config20(self):
""" No project color value. """ """ No project color value. """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment