Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
792:2136be5a44a8 | 793:cb2db0d85029 |
---|---|
19 | 19 |
20 from sat.core.i18n import _ | 20 from sat.core.i18n import _ |
21 from sat.test import helpers | 21 from sat.test import helpers |
22 from twisted.trial import unittest | 22 from twisted.trial import unittest |
23 import traceback | 23 import traceback |
24 import logging | |
24 from constants import Const | 25 from constants import Const |
25 from xml.dom import minidom | 26 from xml.dom import minidom |
26 | 27 |
27 | 28 |
28 class MemoryTest(unittest.TestCase): | 29 class MemoryTest(unittest.TestCase): |
133 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async) | 134 self._getParams(Const.NO_SECURITY_LIMIT).addCallback(self.assertParamExists_async) |
134 self._getParams(0).addCallback(self.assertParamNotExists_async) | 135 self._getParams(0).addCallback(self.assertParamNotExists_async) |
135 self._getParams(1).addCallback(self.assertParamExists_async) | 136 self._getParams(1).addCallback(self.assertParamExists_async) |
136 | 137 |
137 def test_paramsRegisterApp(self): | 138 def test_paramsRegisterApp(self): |
139 | |
140 def register(*args): | |
141 logger = logging.getLogger() | |
142 level = logger.getEffectiveLevel() | |
143 logger.setLevel(logging.INFO) | |
144 self.host.memory.paramsRegisterApp(*args) | |
145 logger.setLevel(level) | |
146 | |
138 # tests with no security level on the parameter (most secure) | 147 # tests with no security level on the parameter (most secure) |
139 params = self._getParamXML() | 148 params = self._getParamXML() |
140 self.host.memory.init() | 149 self.host.memory.init() |
141 self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) | 150 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
142 self.assertParamExists() | 151 self.assertParamExists() |
143 self.host.memory.init() | 152 self.host.memory.init() |
144 self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME) | 153 register(params, 0, Const.APP_NAME) |
145 self.assertParamNotExists() | 154 self.assertParamNotExists() |
146 self.host.memory.init() | 155 self.host.memory.init() |
147 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME) | 156 register(params, 1, Const.APP_NAME) |
148 self.assertParamNotExists() | 157 self.assertParamNotExists() |
149 # tests with security level 0 on the parameter (not secure) | 158 # tests with security level 0 on the parameter (not secure) |
150 params = self._getParamXML(security_level=0) | 159 params = self._getParamXML(security_level=0) |
151 self.host.memory.init() | 160 self.host.memory.init() |
152 self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) | 161 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
153 self.assertParamExists() | 162 self.assertParamExists() |
154 self.host.memory.init() | 163 self.host.memory.init() |
155 self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME) | 164 register(params, 0, Const.APP_NAME) |
156 self.assertParamExists() | 165 self.assertParamExists() |
157 self.host.memory.init() | 166 self.host.memory.init() |
158 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME) | 167 register(params, 1, Const.APP_NAME) |
159 self.assertParamExists() | 168 self.assertParamExists() |
160 # tests with security level 1 on the parameter (more secure) | 169 # tests with security level 1 on the parameter (more secure) |
161 params = self._getParamXML(security_level=1) | 170 params = self._getParamXML(security_level=1) |
162 self.host.memory.init() | 171 self.host.memory.init() |
163 self.host.memory.paramsRegisterApp(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) | 172 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) |
164 self.assertParamExists() | 173 self.assertParamExists() |
165 self.host.memory.init() | 174 self.host.memory.init() |
166 self.host.memory.paramsRegisterApp(params, 0, Const.APP_NAME) | 175 register(params, 0, Const.APP_NAME) |
167 self.assertParamNotExists() | 176 self.assertParamNotExists() |
168 self.host.memory.init() | 177 self.host.memory.init() |
169 self.host.memory.paramsRegisterApp(params, 1, Const.APP_NAME) | 178 register(params, 1, Const.APP_NAME) |
170 self.assertParamExists() | 179 self.assertParamExists() |
171 | 180 |
172 def test_paramsRegisterApp_getParams(self): | 181 def test_paramsRegisterApp_getParams(self): |
173 # test retrieving the parameter for a specific frontend | 182 # test retrieving the parameter for a specific frontend |
174 self.host.memory.init() | 183 self.host.memory.init() |