Skip to content

Commit 539cbe5

Browse files
committed
starter tests for roundup/configuration.py
1 parent ffc525f commit 539cbe5

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/test_config.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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")

0 commit comments

Comments
 (0)