forked from openlp/openlp
Fix call path
Fix PEP8 errors bzr-revno: 2378
This commit is contained in:
commit
8507924b7e
@ -229,7 +229,7 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
|
||||
self.service_path = os.path.join(AppLocation.get_section_data_path(self.settings_section), 'thumbnails')
|
||||
check_directory_exists(self.service_path)
|
||||
self.load_list(Settings().value(self.settings_section + '/media files'))
|
||||
self.populate_display_types()
|
||||
self.rebuild_players()
|
||||
|
||||
def rebuild_players(self):
|
||||
"""
|
||||
|
@ -171,4 +171,4 @@ class TestImageManager(TestCase, TestMixin):
|
||||
self.lock.release()
|
||||
# The sleep time is adjusted in the test case.
|
||||
time.sleep(self.sleep_time)
|
||||
return ''
|
||||
return ''
|
||||
|
@ -125,4 +125,4 @@ class TestMedia(TestCase, TestMixin):
|
||||
|
||||
# THEN: the used_players should be an empty list, and the overridden player should be an empty string
|
||||
self.assertEqual(['vlc', 'webkit', 'phonon'], used_players, 'Used players should be correct')
|
||||
self.assertEqual('vlc,webkit,phonon', overridden_player, 'Overridden player should be a string of players')
|
||||
self.assertEqual('vlc,webkit,phonon', overridden_player, 'Overridden player should be a string of players')
|
||||
|
@ -33,7 +33,7 @@ from unittest import TestCase
|
||||
|
||||
from openlp.core.ui import SlideController
|
||||
|
||||
from tests.interfaces import MagicMock, patch
|
||||
from tests.interfaces import MagicMock
|
||||
|
||||
|
||||
class TestSlideController(TestCase):
|
||||
|
@ -32,7 +32,7 @@ This module contains tests for the lib submodule of the Remotes plugin.
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
from openlp.core.common import Settings
|
||||
from openlp.core.common import Settings, Registry
|
||||
from openlp.plugins.remotes.lib.httpserver import HttpRouter
|
||||
from tests.functional import MagicMock, patch, mock_open
|
||||
from tests.helpers.testmixin import TestMixin
|
||||
@ -92,15 +92,14 @@ class TestRouter(TestCase, TestMixin):
|
||||
Test the router control functionality
|
||||
"""
|
||||
# GIVEN: A testing set of Routes
|
||||
router = HttpRouter()
|
||||
mocked_function = MagicMock()
|
||||
test_route = [
|
||||
(r'^/stage/api/poll$', {'function': mocked_function, 'secure': False}),
|
||||
]
|
||||
router.routes = test_route
|
||||
self.router.routes = test_route
|
||||
|
||||
# WHEN: called with a poll route
|
||||
function, args = router.process_http_request('/stage/api/poll', None)
|
||||
function, args = self.router.process_http_request('/stage/api/poll', None)
|
||||
|
||||
# THEN: the function should have been called only once
|
||||
self.assertEqual(mocked_function, function['function'], 'The mocked function should match defined value.')
|
||||
@ -126,6 +125,25 @@ class TestRouter(TestCase, TestMixin):
|
||||
# THEN: all types should match
|
||||
self.assertEqual(content_type, header[1], 'Mismatch of content type')
|
||||
|
||||
def main_poll_test(self):
|
||||
"""
|
||||
Test the main poll logic
|
||||
"""
|
||||
# GIVEN: a defined router with two slides
|
||||
Registry().register('live_controller', MagicMock)
|
||||
router = HttpRouter()
|
||||
router.send_response = MagicMock()
|
||||
router.send_header = MagicMock()
|
||||
router.end_headers = MagicMock()
|
||||
router.live_controller.slide_count = 2
|
||||
|
||||
# WHEN: main poll called
|
||||
results = router.main_poll()
|
||||
|
||||
# THEN: the correct response should be returned
|
||||
self.assertEqual(results.decode('utf-8'), '{"results": {"slide_count": 2}}',
|
||||
'The resulting json strings should match')
|
||||
|
||||
def serve_file_without_params_test(self):
|
||||
"""
|
||||
Test the serve_file method without params
|
||||
|
@ -62,4 +62,4 @@ class TestHistoryComboBox(TestCase, TestMixin):
|
||||
self.combo.addItem('test2')
|
||||
|
||||
# THEN: The list of items should contain both strings.
|
||||
self.assertEqual(self.combo.getItems(), ['test1', 'test2'])
|
||||
self.assertEqual(self.combo.getItems(), ['test1', 'test2'])
|
||||
|
@ -75,4 +75,4 @@ class TestShortcutform(TestCase, TestMixin):
|
||||
# THEN: The button should be changed.
|
||||
self.assertEqual(button.text(), text, "The text should match.")
|
||||
mocked_check_method.assert_called_once_with(True)
|
||||
self.assertEqual(button.isEnabled(), enabled, "The button should be disabled.")
|
||||
self.assertEqual(button.isEnabled(), enabled, "The button should be disabled.")
|
||||
|
Loading…
Reference in New Issue
Block a user