To make sure kimchi server has the same configuration as what we
defined in Server class, this patch copies the original configuration
code and verify it's equal to what's generated from KimchiConfig class.
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
tests/test_config.py.in | 77 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 75 insertions(+), 2 deletions(-)
diff --git a/tests/test_config.py.in b/tests/test_config.py.in
index 7d8a6a7..06f9300 100644
--- a/tests/test_config.py.in
+++ b/tests/test_config.py.in
@@ -19,8 +19,8 @@
import unittest
-
-from kimchi.config import Paths, PluginPaths
+from kimchi import config
+from kimchi.config import Paths, PluginPaths, KimchiConfig
get_prefix = None
@@ -85,3 +85,76 @@ class ConfigTests(unittest.TestCase):
self.assertEquals(paths.src_dir, '/home/user/kimchi/plugins/sample')
self.assertEquals(paths.ui_dir, '/home/user/kimchi/plugins/sample/ui')
self.assertEquals(paths.mo_dir, '/home/user/kimchi/plugins/sample/mo')
+
+ def test_kimchi_config(self):
+ Paths.get_prefix = PluginPaths.get_prefix = get_prefix
+ paths = Paths()
+ CACHEEXPIRES = 31536000
+ configObj = {
+ '/': {'tools.trailing_slash.on': False,
+ 'request.methods_with_bodies': ('POST',
'PUT'),
+ 'tools.nocache.on': True,
+ 'tools.sessions.on': True,
+ 'tools.sessions.name': 'kimchi',
+ 'tools.sessions.httponly': True,
+ 'tools.sessions.locking': 'explicit',
+ 'tools.sessions.storage_type': 'ram',
+ 'tools.kimchiauth.on': False},
+ '/css': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '%s/ui/css' % paths.prefix,
+ 'tools.expires.on': True,
+ 'tools.expires.secs': CACHEEXPIRES,
+ 'tools.nocache.on': False
+ },
+ '/js': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '%s/ui/js' % paths.prefix,
+ 'tools.expires.on': True,
+ 'tools.expires.secs': CACHEEXPIRES,
+ 'tools.nocache.on': False
+ },
+ '/libs': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '%s/ui/libs' % paths.prefix,
+ 'tools.expires.on': True,
+ 'tools.expires.secs': CACHEEXPIRES,
+ 'tools.nocache.on': False,
+ },
+ '/images': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '%s/ui/images' % paths.prefix,
+ 'tools.nocache.on': False
+ },
+ '/data/screenshots': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': config.get_screenshot_path(),
+ 'tools.nocache.on': False
+ },
+ '/data/debugreports': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': config.get_debugreports_path(),
+ 'tools.nocache.on': False,
+ 'tools.kimchiauth.on': True,
+ 'tools.staticdir.content_types': {'xz':
'application/x-xz'}
+ },
+ '/config/ui/tabs.xml': {
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename': '%s/config/ui/tabs.xml' %
+ paths.prefix,
+ 'tools.nocache.on': True
+ },
+ '/favicon.ico': {
+ 'tools.staticfile.on': True,
+ 'tools.staticfile.filename':
+ '%s/images/logo.ico' % paths.ui_dir
+ },
+ '/help': {
+ 'tools.staticdir.on': True,
+ 'tools.staticdir.dir': '%s/ui/pages/help' %
paths.prefix,
+ 'tools.nocache.on': False
+ }
+ }
+
+ kimchi_config = KimchiConfig()
+ self.assertEquals(kimchi_config, configObj)
--
1.8.4.2