0

Start of some unit tests for setting.py parsing

This commit is contained in:
Andrew Chin
2011-12-28 16:04:24 -05:00
parent 79356e4664
commit 2d99aef78f
5 changed files with 35 additions and 0 deletions

24
test/test_settings.py Normal file
View File

@@ -0,0 +1,24 @@
import unittest
from overviewer_core import configParser
from overviewer_core.settingsValidators import ValidationException
class SettingsTest(unittest.TestCase):
def test_missing(self):
"Validates that a non-existant settings.py causes an exception"
self.assertRaises(ValueError, configParser.MultiWorldParser, "doesnotexist.py")
def test_existing_file(self):
s = configParser.MultiWorldParser("test/data/settings/settings_test_1.py")
s.parse()
s.validate()
things = s.get_render_things()
# no exceptions so far. that's good
def test_rendermode_validation(self):
s = configParser.MultiWorldParser("test/data/settings/settings_test_rendermode.py")
s.parse()
self.assertRaises(ValidationException,s.validate)
if __name__ == "__main__":
unittest.main()