Mercurial > p > roundup > code
diff test/test_config.py @ 5126:dd642afb4440
starter tests for roundup/configuration.py
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 03 Jul 2016 21:21:29 -0400 |
| parents | |
| children | f91da208f26b |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/test_config.py Sun Jul 03 21:21:29 2016 -0400 @@ -0,0 +1,52 @@ +# +# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) +# This module is free software, and you may redistribute it and/or modify +# under the same terms as Python, so long as this copyright message and +# disclaimer are retained in their original form. +# +# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR +# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING +# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" +# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, +# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +import unittest +import logging + +import pytest +from roundup import configuration + +config = configuration.CoreConfig() +config.DATABASE = "db" +config.RDBMS_NAME = "rounduptest" +config.RDBMS_HOST = "localhost" +config.RDBMS_USER = "rounduptest" +config.RDBMS_PASSWORD = "rounduptest" +config.RDBMS_TEMPLATE = "template0" +# these TRACKER_WEB and MAIL_DOMAIN values are used in mailgw tests +config.MAIL_DOMAIN = "your.tracker.email.domain.example" +config.TRACKER_WEB = "http://tracker.example/cgi-bin/roundup.cgi/bugs/" +# uncomment the following to have excessive debug output from test cases +# FIXME: tracker logging level should be increased by -v arguments +# to 'run_tests.py' script +#config.LOGGING_FILENAME = "/tmp/logfile" +#config.LOGGING_LEVEL = "DEBUG" +config.init_logging() +config.options['FOO'] = "value" + +class ConfigTest(unittest.TestCase): + + def test_badConfigKeyword(self): + """Run configure tests looking for invalid option name + """ + self.assertRaises(configuration.InvalidOptionError, config._get_option, "BadOptionName") + + def test_validConfigKeyword(self): + """Run configure tests looking for invalid option name + """ + self.assertEquals(config._get_option("FOO"), "value")
