fix tests

This commit is contained in:
Tim Bentley 2016-06-14 21:18:20 +01:00
parent 7d049eb2af
commit 5a0f2f1781
4 changed files with 8 additions and 8 deletions

View File

@ -54,4 +54,4 @@ from .wsserver import WsServer
from .httpserver import HttpServer
from .apicontroller import ApiController
__all__ = ['Poll', 'RemoteController', 'HttpServer', 'application']
__all__ = ['Poll', 'ApiController', 'HttpServer', 'application']

View File

@ -49,6 +49,6 @@ class ApiController(RegistryMixin, OpenLPMixin, RegistryProperties):
Register the poll return service and start the servers.
"""
self.poll = Poll()
Registry().register('OpenLPPoll', self.poll)
Registry().register('api_poll', self.poll)
self.wsserver = WsServer()
self.httpserver = HttpServer()

View File

@ -125,17 +125,17 @@ class WsServer(RegistryProperties, OpenLPMixin):
log.debug("web socket handler registered with client")
previous_poll = None
previous_main_poll = None
openlppoll = Registry().get('OpenLPPoll')
api_poll = Registry().get('api_poll')
if path == '/poll':
while True:
current_poll = openlppoll.poll()
current_poll = api_poll.poll()
if current_poll != previous_poll:
yield from request.send(current_poll)
previous_poll = current_poll
yield from asyncio.sleep(0.2)
elif path == '/main_poll':
while True:
main_poll = openlppoll.main_poll()
main_poll = api_poll.main_poll()
if main_poll != previous_main_poll:
yield from request.send(main_poll)
previous_main_poll = main_poll

View File

@ -35,9 +35,9 @@ class TestApiController(TestCase):
"""
A test suite to test out the Error in the API code
"""
@patch('openlp.core.api.apicontroller.OpenLPPoll')
@patch('openlp.core.api.apicontroller.OpenLPWSServer')
@patch('openlp.core.api.apicontroller.OpenLPHttpServer')
@patch('openlp.core.api.apicontroller.Poll')
@patch('openlp.core.api.apicontroller.WsServer')
@patch('openlp.core.api.apicontroller.HttpServer')
def test_bootstrap(self, mock_http, mock_ws, mock_poll):
"""
Test the Not Found error displays the correct information