Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelarnauts committed Jun 11, 2020
1 parent 5257dfc commit c7a0a6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/mocks/plugin.video.example/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def send_channels(): # pylint: disable=no-method-argument
preset=1,
stream='plugin://plugin.video.example/play/1',
logo='https://example.com/channel1.png',
vod='plugin://plugin.video.example/play/airdate/{date}'
vod='plugin://plugin.video.example/play/airdate/{start}/{stop}/{duration}'
),
dict(
id='channel2.com',
Expand Down
15 changes: 8 additions & 7 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,19 @@ def test_refresh(self):
})

# Get the current selected EPG item
program = ContextMenu.get_selection()
self.assertTrue(program)
self.assertEqual(program.get('duration'), 3600)
self.assertEqual(program.get('channel'), 'Channel 1')
selection = ContextMenu._get_selection() # pylint: disable=protected-access
self.assertTrue(selection)
self.assertEqual(selection.get('duration'), 3600)
self.assertEqual(selection.get('channel'), 'Channel 1')

# Make sure we can detect that playback has started
if os.path.exists('/tmp/playback-started.txt'):
os.unlink('/tmp/playback-started.txt')

with patch('xbmcgui.Dialog.select', return_value=0):
# Try to play it
ContextMenu.play(program)
from resources.lib.functions import play_from_contextmenu
play_from_contextmenu()

# Check that something has played
self.assertTrue(self._wait_for_file('/tmp/playback-started.txt'))
Expand All @@ -88,8 +89,8 @@ def test_refresh(self):
sys.listitem = ListItem(path='pvr://guide/0012/2020-05-24 12:00:00.epg')

# Get the current selected EPG item, but the selected item is wrong.
program = ContextMenu.get_selection()
self.assertIsNone(program)
selection = ContextMenu._get_selection() # pylint: disable=protected-access
self.assertIsNone(selection)

@staticmethod
def _wait_for_file(filename, timeout=10):
Expand Down

0 comments on commit c7a0a6e

Please sign in to comment.