comparison src/test/test_memory.py @ 1909:0681d69cbe0a

test: add helpers methods muteLogging and unmuteLogging
author souliane <souliane@mailoo.org>
date Fri, 11 Mar 2016 16:41:44 +0100
parents d17772b0fe22
children 55440ee00905
comparison
equal deleted inserted replaced
1908:ffcd7904b655 1909:0681d69cbe0a
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 from sat.core.log import getLogger
25 from logging import INFO
26 from constants import Const 24 from constants import Const
27 from xml.dom import minidom 25 from xml.dom import minidom
28 26
29 27
30 class MemoryTest(unittest.TestCase): 28 class MemoryTest(unittest.TestCase):
203 """ 201 """
204 @param xml: XML definition of the parameters to be added 202 @param xml: XML definition of the parameters to be added
205 @param security_limit: -1 means no security, 0 is the maximum security then the higher the less secure 203 @param security_limit: -1 means no security, 0 is the maximum security then the higher the less secure
206 @param app: name of the frontend registering the parameters 204 @param app: name of the frontend registering the parameters
207 """ 205 """
208 logger = getLogger() 206 helpers.muteLogging()
209 level = logger.getEffectiveLevel()
210 logger.setLevel(INFO)
211 self.host.memory.paramsRegisterApp(xml, security_limit, app) 207 self.host.memory.paramsRegisterApp(xml, security_limit, app)
212 logger.setLevel(level) 208 helpers.unmuteLogging()
213 209
214 # tests with no security level on the parameter (most secure) 210 # tests with no security level on the parameter (most secure)
215 params = self._getParamXML() 211 params = self._getParamXML()
216 self.host.memory.reinit() 212 self.host.memory.reinit()
217 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME) 213 register(params, Const.NO_SECURITY_LIMIT, Const.APP_NAME)