Mercurial > libervia-backend
diff src/test/test_memory.py @ 793:cb2db0d85029
test: silent info/warning that were polluting the output
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 10 Jan 2014 18:19:34 +0100 |
parents | 0cb423500fbb |
children |
line wrap: on
line diff
--- a/src/test/test_memory.py Thu Jan 09 11:18:33 2014 +0100 +++ b/src/test/test_memory.py Fri Jan 10 18:19:34 2014 +0100 @@ -21,6 +21,7 @@ from sat.test import helpers from twisted.trial import unittest import traceback +import logging from constants import Const from xml.dom import minidom @@ -135,38 +136,46 @@ self._getParams(1).addCallback(self.assertParamExists_async) def test_paramsRegisterApp(self): + + def register(*args): + logger = logging.getLogger() + level = logger.getEffectiveLevel() + logger.setLevel(logging.INFO) + self.host.memory.paramsRegisterApp(*args) + logger.setLevel(level) + # tests with no security level on the parameter (most secure) params = self._getParamXML() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) + register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) self.assertParamExists() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME) + register(params, 0, Const.APP_NAME) self.assertParamNotExists() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME) + register(params, 1, Const.APP_NAME) self.assertParamNotExists() # tests with security level 0 on the parameter (not secure) params = self._getParamXML(security_level=0) self.host.memory.init() - self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) + register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) self.assertParamExists() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME) + register(params, 0, Const.APP_NAME) self.assertParamExists() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME) + register(params, 1, Const.APP_NAME) self.assertParamExists() # tests with security level 1 on the parameter (more secure) params = self._getParamXML(security_level=1) self.host.memory.init() - self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) + register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) self.assertParamExists() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME) + register(params, 0, Const.APP_NAME) self.assertParamNotExists() self.host.memory.init() - self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME) + register(params, 1, Const.APP_NAME) self.assertParamExists() def test_paramsRegisterApp_getParams(self):