Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 5125:410e565b5c1f | 5126:dd642afb4440 |
|---|---|
| 1 # | |
| 2 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) | |
| 3 # This module is free software, and you may redistribute it and/or modify | |
| 4 # under the same terms as Python, so long as this copyright message and | |
| 5 # disclaimer are retained in their original form. | |
| 6 # | |
| 7 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR | |
| 8 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING | |
| 9 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE | |
| 10 # POSSIBILITY OF SUCH DAMAGE. | |
| 11 # | |
| 12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | |
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
| 17 | |
| 18 import unittest | |
| 19 import logging | |
| 20 | |
| 21 import pytest | |
| 22 from roundup import configuration | |
| 23 | |
| 24 config = configuration.CoreConfig() | |
| 25 config.DATABASE = "db" | |
| 26 config.RDBMS_NAME = "rounduptest" | |
| 27 config.RDBMS_HOST = "localhost" | |
| 28 config.RDBMS_USER = "rounduptest" | |
| 29 config.RDBMS_PASSWORD = "rounduptest" | |
| 30 config.RDBMS_TEMPLATE = "template0" | |
| 31 # these TRACKER_WEB and MAIL_DOMAIN values are used in mailgw tests | |
| 32 config.MAIL_DOMAIN = "your.tracker.email.domain.example" | |
| 33 config.TRACKER_WEB = "http://tracker.example/cgi-bin/roundup.cgi/bugs/" | |
| 34 # uncomment the following to have excessive debug output from test cases | |
| 35 # FIXME: tracker logging level should be increased by -v arguments | |
| 36 # to 'run_tests.py' script | |
| 37 #config.LOGGING_FILENAME = "/tmp/logfile" | |
| 38 #config.LOGGING_LEVEL = "DEBUG" | |
| 39 config.init_logging() | |
| 40 config.options['FOO'] = "value" | |
| 41 | |
| 42 class ConfigTest(unittest.TestCase): | |
| 43 | |
| 44 def test_badConfigKeyword(self): | |
| 45 """Run configure tests looking for invalid option name | |
| 46 """ | |
| 47 self.assertRaises(configuration.InvalidOptionError, config._get_option, "BadOptionName") | |
| 48 | |
| 49 def test_validConfigKeyword(self): | |
| 50 """Run configure tests looking for invalid option name | |
| 51 """ | |
| 52 self.assertEquals(config._get_option("FOO"), "value") |
