comparison src/test/test_plugin_misc_radiocol.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 radiocol """ 21 """ Tests for the plugin radiocol """
22 22
23 from sat.core import exceptions 23 from sat.core import exceptions
24 from sat.core.log import getLogger
24 from sat.test import helpers, helpers_plugins 25 from sat.test import helpers, helpers_plugins
25 from sat.plugins import plugin_misc_radiocol as plugin 26 from sat.plugins import plugin_misc_radiocol as plugin
26 from sat.plugins import plugin_misc_room_game as plugin_room_game 27 from sat.plugins import plugin_misc_room_game as plugin_room_game
27 from constants import Const 28 from constants import Const
28 29
34 from twisted.trial.unittest import SkipTest 35 from twisted.trial.unittest import SkipTest
35 36
36 from mutagen.oggvorbis import OggVorbis 37 from mutagen.oggvorbis import OggVorbis
37 38
38 import uuid 39 import uuid
39 import logging
40 import os 40 import os
41 import copy 41 import copy
42 import shutil 42 import shutil
43 from logging import WARNING
43 44
44 ROOM_JID_S = Const.MUC_STR[0] 45 ROOM_JID_S = Const.MUC_STR[0]
45 PROFILE = Const.PROFILE[0] 46 PROFILE = Const.PROFILE[0]
46 REFEREE_FULL = ROOM_JID_S + '/' + Const.JID[0].user 47 REFEREE_FULL = ROOM_JID_S + '/' + Const.JID[0].user
47 PLAYERS_INDICES = [0, 1, 3] # referee included 48 PLAYERS_INDICES = [0, 1, 3] # referee included
59 self.host.plugins['ROOM-GAME'] = plugin_room_game.RoomGame(self.host) 60 self.host.plugins['ROOM-GAME'] = plugin_room_game.RoomGame(self.host)
60 self.plugin = plugin.Radiocol(self.host) # must be init after ROOM-GAME 61 self.plugin = plugin.Radiocol(self.host) # must be init after ROOM-GAME
61 self.plugin.testing = True 62 self.plugin.testing = True
62 self.plugin_0045 = self.host.plugins['XEP-0045'] = helpers_plugins.FakeXEP_0045(self.host) 63 self.plugin_0045 = self.host.plugins['XEP-0045'] = helpers_plugins.FakeXEP_0045(self.host)
63 self.plugin_0249 = self.host.plugins['XEP-0249'] = helpers_plugins.FakeXEP_0249(self.host) 64 self.plugin_0249 = self.host.plugins['XEP-0249'] = helpers_plugins.FakeXEP_0249(self.host)
64 logger = logging.getLogger() 65 logger = getLogger()
65 level = logger.getEffectiveLevel() 66 level = logger.getEffectiveLevel()
66 logger.setLevel(logging.WARNING) # remove log.info pollution 67 logger.setLevel(WARNING) # remove log.info pollution
67 for profile in Const.PROFILE: 68 for profile in Const.PROFILE:
68 self.host.getClient(profile) # init self.host.profiles[profile] 69 self.host.getClient(profile) # init self.host.profiles[profile]
69 logger.setLevel(level) 70 logger.setLevel(level)
70 self.songs = [] 71 self.songs = []
71 self.playlist = [] 72 self.playlist = []