forked from openlp/openlp
fix tests
This commit is contained in:
parent
7d049eb2af
commit
5a0f2f1781
@ -54,4 +54,4 @@ from .wsserver import WsServer
|
|||||||
from .httpserver import HttpServer
|
from .httpserver import HttpServer
|
||||||
from .apicontroller import ApiController
|
from .apicontroller import ApiController
|
||||||
|
|
||||||
__all__ = ['Poll', 'RemoteController', 'HttpServer', 'application']
|
__all__ = ['Poll', 'ApiController', 'HttpServer', 'application']
|
||||||
|
@ -49,6 +49,6 @@ class ApiController(RegistryMixin, OpenLPMixin, RegistryProperties):
|
|||||||
Register the poll return service and start the servers.
|
Register the poll return service and start the servers.
|
||||||
"""
|
"""
|
||||||
self.poll = Poll()
|
self.poll = Poll()
|
||||||
Registry().register('OpenLPPoll', self.poll)
|
Registry().register('api_poll', self.poll)
|
||||||
self.wsserver = WsServer()
|
self.wsserver = WsServer()
|
||||||
self.httpserver = HttpServer()
|
self.httpserver = HttpServer()
|
||||||
|
@ -125,17 +125,17 @@ class WsServer(RegistryProperties, OpenLPMixin):
|
|||||||
log.debug("web socket handler registered with client")
|
log.debug("web socket handler registered with client")
|
||||||
previous_poll = None
|
previous_poll = None
|
||||||
previous_main_poll = None
|
previous_main_poll = None
|
||||||
openlppoll = Registry().get('OpenLPPoll')
|
api_poll = Registry().get('api_poll')
|
||||||
if path == '/poll':
|
if path == '/poll':
|
||||||
while True:
|
while True:
|
||||||
current_poll = openlppoll.poll()
|
current_poll = api_poll.poll()
|
||||||
if current_poll != previous_poll:
|
if current_poll != previous_poll:
|
||||||
yield from request.send(current_poll)
|
yield from request.send(current_poll)
|
||||||
previous_poll = current_poll
|
previous_poll = current_poll
|
||||||
yield from asyncio.sleep(0.2)
|
yield from asyncio.sleep(0.2)
|
||||||
elif path == '/main_poll':
|
elif path == '/main_poll':
|
||||||
while True:
|
while True:
|
||||||
main_poll = openlppoll.main_poll()
|
main_poll = api_poll.main_poll()
|
||||||
if main_poll != previous_main_poll:
|
if main_poll != previous_main_poll:
|
||||||
yield from request.send(main_poll)
|
yield from request.send(main_poll)
|
||||||
previous_main_poll = main_poll
|
previous_main_poll = main_poll
|
||||||
|
@ -35,9 +35,9 @@ class TestApiController(TestCase):
|
|||||||
"""
|
"""
|
||||||
A test suite to test out the Error in the API code
|
A test suite to test out the Error in the API code
|
||||||
"""
|
"""
|
||||||
@patch('openlp.core.api.apicontroller.OpenLPPoll')
|
@patch('openlp.core.api.apicontroller.Poll')
|
||||||
@patch('openlp.core.api.apicontroller.OpenLPWSServer')
|
@patch('openlp.core.api.apicontroller.WsServer')
|
||||||
@patch('openlp.core.api.apicontroller.OpenLPHttpServer')
|
@patch('openlp.core.api.apicontroller.HttpServer')
|
||||||
def test_bootstrap(self, mock_http, mock_ws, mock_poll):
|
def test_bootstrap(self, mock_http, mock_ws, mock_poll):
|
||||||
"""
|
"""
|
||||||
Test the Not Found error displays the correct information
|
Test the Not Found error displays the correct information
|
||||||
|
Loading…
Reference in New Issue
Block a user