comparison src/test/test_plugin_misc_room_game.py @ 997:b3f383ab39da

test: configuration/use of new logging system
author Goffi <goffi@goffi.org>
date Mon, 21 Apr 2014 20:04:52 +0200
parents 301b342c697a
children 2308f8405ffb
comparison
equal deleted inserted replaced
996:e99b6dfd567b 997:b3f383ab39da
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. 19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21 """ Tests for the plugin room game (base class for MUC games) """ 21 """ Tests for the plugin room game (base class for MUC games) """
22 22
23 from sat.core.i18n import _ 23 from sat.core.i18n import _
24 from sat.core.log import getLogger
24 from constants import Const 25 from constants import Const
25 from sat.test import helpers, helpers_plugins 26 from sat.test import helpers, helpers_plugins
26 from sat.plugins import plugin_misc_room_game as plugin 27 from sat.plugins import plugin_misc_room_game as plugin
27 from twisted.words.protocols.jabber.jid import JID 28 from twisted.words.protocols.jabber.jid import JID
28 from wokkel.muc import User 29 from wokkel.muc import User
29 import logging 30
31 from logging import WARNING
30 32
31 # Data used for test initialization 33 # Data used for test initialization
32 NAMESERVICE = 'http://www.goffi.org/protocol/dummy' 34 NAMESERVICE = 'http://www.goffi.org/protocol/dummy'
33 TAG = 'dummy' 35 TAG = 'dummy'
34 PLUGIN_INFO = { 36 PLUGIN_INFO = {
56 self.host.init() 58 self.host.init()
57 self.plugin = plugin.RoomGame(self.host) 59 self.plugin = plugin.RoomGame(self.host)
58 self.plugin._init_(self.host, PLUGIN_INFO, (NAMESERVICE, TAG), game_init, player_init) 60 self.plugin._init_(self.host, PLUGIN_INFO, (NAMESERVICE, TAG), game_init, player_init)
59 self.plugin_0045 = self.host.plugins['XEP-0045'] = helpers_plugins.FakeXEP_0045(self.host) 61 self.plugin_0045 = self.host.plugins['XEP-0045'] = helpers_plugins.FakeXEP_0045(self.host)
60 self.plugin_0249 = self.host.plugins['XEP-0249'] = helpers_plugins.FakeXEP_0249(self.host) 62 self.plugin_0249 = self.host.plugins['XEP-0249'] = helpers_plugins.FakeXEP_0249(self.host)
61 logger = logging.getLogger() 63 logger = getLogger()
62 level = logger.getEffectiveLevel() 64 level = logger.getEffectiveLevel()
63 logger.setLevel(logging.WARNING) # remove log.info pollution 65 logger.setLevel(WARNING) # remove log.info pollution
64 for profile in Const.PROFILE: 66 for profile in Const.PROFILE:
65 self.host.getClient(profile) # init self.host.profiles[profile] 67 self.host.getClient(profile) # init self.host.profiles[profile]
66 logger.setLevel(level) 68 logger.setLevel(level)
67 69
68 def initGame(self, muc_index, user_index): 70 def initGame(self, muc_index, user_index):