Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
124 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from __future__ import unicode_literals | ||
|
||
import logging | ||
|
||
from mock import Mock, sentinel | ||
|
||
from mopidy.internal import network | ||
from mopidy.mpd import dispatcher, session | ||
|
||
|
||
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 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 = ['foo'] | ||
|
||
mpd_session.on_line_received(sentinel.line) | ||
|
||
assert 'Request from %s: %s' % (connection, sentinel.line) in caplog.text | ||
assert 'Response to %s: %s\n' % (connection, 'foo') in caplog.text |