The model instance represents which logic will be set for each REST API
available in the server configuration.
It was there for testing matters and wrongly used in the plugins tests
as it has been using to set the plugin model instance for Wok APIs (?)
To avoid problems, remove that capability.
Also updates run_server() to remove the model parameter.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/wok/server.py | 9 ++-------
tests/utils.py | 5 +----
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py
index f64a6a2..d99b91f 100644
--- a/src/wok/server.py
+++ b/src/wok/server.py
@@ -146,19 +146,14 @@ class Server(object):
if not dev_env:
cherrypy.config.update({'environment': 'production'})
- if hasattr(options, 'model'):
- model_instance = options.model
- else:
- model_instance = model.Model()
-
for ident, node in sub_nodes.items():
if node.url_auth:
cfg = self.configObj
ident = "/%s" % ident
cfg[ident] = {'tools.wokauth.on': True}
- self.app = cherrypy.tree.mount(WokRoot(model_instance, dev_env),
- options.server_root, self.configObj)
+ cherrypy.tree.mount(WokRoot(model.Model(), dev_env),
+ options.server_root, self.configObj)
self._load_plugins()
cherrypy.lib.sessions.init()
diff --git a/tests/utils.py b/tests/utils.py
index 739434f..9c18637 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -88,7 +88,7 @@ if sys.version_info[:2] == (2, 6):
unittest.TestCase.assertNotIn = assertNotIn
-def run_server(test_mode, model=None, environment='dev',
server_root=''):
+def run_server(test_mode, environment='dev', server_root=''):
args = type('_', (object,),
{'cherrypy_port': 8010, 'max_body_size':
'4*1024',
@@ -97,9 +97,6 @@ def run_server(test_mode, model=None, environment='dev',
server_root=''):
'log_level': 'debug', 'session_timeout': 10,
'server_root': server_root})()
- if model is not None:
- setattr(args, 'model', model)
-
s = wok.server.Server(args)
t = threading.Thread(target=s.start)
t.setDaemon(True)
--
2.9.3