Black
This commit is contained in:
1 parent
da05dfe708
commit
4de97abc3a
2676 files changed
+163166
-140084
No files matched your search
@@ -12,7 +12,7 @@ class FakeLgWebOSDevice(webostv.LgWebOSDevice):
|
||||
"""Initialise parameters needed for tests with fake values."""
|
||||
self._source_list = {}
|
||||
self._client = mock.MagicMock()
|
||||
self._name = 'fake_device'
|
||||
self._name = "fake_device"
|
||||
self._current_source = None
|
||||
|
||||
|
||||
@@ -25,36 +25,32 @@ class TestLgWebOSDevice(unittest.TestCase):
|
||||
|
||||
def test_select_source_with_empty_source_list(self):
|
||||
"""Ensure we don't call client methods when we don't have sources."""
|
||||
self.device.select_source('nonexistent')
|
||||
self.device.select_source("nonexistent")
|
||||
assert 0 == self.device._client.launch_app.call_count
|
||||
assert 0 == self.device._client.set_input.call_count
|
||||
|
||||
def test_select_source_with_titled_entry(self):
|
||||
"""Test that a titled source is treated as an app."""
|
||||
self.device._source_list = {
|
||||
'existent': {
|
||||
'id': 'existent_id',
|
||||
'title': 'existent_title',
|
||||
},
|
||||
"existent": {"id": "existent_id", "title": "existent_title"}
|
||||
}
|
||||
|
||||
self.device.select_source('existent')
|
||||
self.device.select_source("existent")
|
||||
|
||||
assert 'existent_title' == self.device._current_source
|
||||
assert [mock.call('existent_id')] == (
|
||||
self.device._client.launch_app.call_args_list)
|
||||
assert "existent_title" == self.device._current_source
|
||||
assert [mock.call("existent_id")] == (
|
||||
self.device._client.launch_app.call_args_list
|
||||
)
|
||||
|
||||
def test_select_source_with_labelled_entry(self):
|
||||
"""Test that a labelled source is treated as an input source."""
|
||||
self.device._source_list = {
|
||||
'existent': {
|
||||
'id': 'existent_id',
|
||||
'label': 'existent_label',
|
||||
},
|
||||
"existent": {"id": "existent_id", "label": "existent_label"}
|
||||
}
|
||||
|
||||
self.device.select_source('existent')
|
||||
self.device.select_source("existent")
|
||||
|
||||
assert 'existent_label' == self.device._current_source
|
||||
assert [mock.call('existent_id')] == (
|
||||
self.device._client.set_input.call_args_list)
|
||||
assert "existent_label" == self.device._current_source
|
||||
assert [mock.call("existent_id")] == (
|
||||
self.device._client.set_input.call_args_list
|
||||
)
|
||||
Reference in new issue
Block a user