def test_on_start_logged(caplog): caplog.set_level(logging.INFO) connection = Mock(spec=network.Connection) session.MpdSession(connection).on_start() assert 'New MPD connection from %s' % connection in caplog.text
def setUp(self): self.backend = dummy.create_dummy_backend_proxy() self.core = core.Core.start(backends=[self.backend]).proxy() self.connection = MockConnection() self.session = session.MpdSession(self.connection, config=self.get_config(), core=self.core) self.dispatcher = self.session.dispatcher self.context = self.dispatcher.context
def test_on_line_received_logged(caplog): caplog.set_level(logging.DEBUG) connection = Mock(spec=network.Connection) mpd_session = session.MpdSession(connection) mpd_session.dispatcher = Mock(spec=dispatcher.MpdDispatcher) mpd_session.dispatcher.handle_request.return_value = [str(sentinel.resp)] mpd_session.on_line_received(sentinel.line) assert 'Request from %s: %s' % (connection, sentinel.line) in caplog.text assert 'Response to %s:' % (connection, ) in caplog.text
def setUp(self): # noqa: N802 if self.enable_mixer: self.mixer = dummy_mixer.create_proxy() else: self.mixer = None self.backend = dummy_backend.create_proxy() self.core = core.Core.start( mixer=self.mixer, backends=[self.backend]).proxy() self.uri_map = uri_mapper.MpdUriMapper(self.core) self.connection = MockConnection() self.session = session.MpdSession( self.connection, config=self.get_config(), core=self.core, uri_map=self.uri_map) self.dispatcher = self.session.dispatcher self.context = self.dispatcher.context