fix some tests

This commit is contained in:
Tim Bentley 2016-06-28 22:39:16 +01:00
parent 7aa1acc176
commit a81cc8292b
5 changed files with 10 additions and 6 deletions

View File

@ -66,6 +66,9 @@ class Endpoint(object):
if not self.template_dir: if not self.template_dir:
raise Exception('No template directory specified') raise Exception('No template directory specified')
path = os.path.abspath(os.path.join(self.template_dir, filename)) path = os.path.abspath(os.path.join(self.template_dir, filename))
print(path)
print(self.static_dir)
print('/{prefix}/static'.format(prefix=self.url_prefix))
# if self.static_dir: # if self.static_dir:
# kwargs['static_url'] = '/{prefix}/static'.format(prefix=self.url_prefix) # kwargs['static_url'] = '/{prefix}/static'.format(prefix=self.url_prefix)
return Template(filename=path, input_encoding='utf-8').render(**kwargs) return Template(filename=path, input_encoding='utf-8').render(**kwargs)

View File

@ -26,7 +26,8 @@ import json
from unittest import TestCase from unittest import TestCase
from openlp.core.common import Registry, Settings from openlp.core.common import Registry, Settings
from openlp.core.api import Poll, WebSocketServer from openlp.core.api.websockets import WebSocketServer
from openlp.core.api.poll import Poller
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
@ -52,7 +53,7 @@ class TestWSServer(TestCase, TestMixin):
self.build_settings() self.build_settings()
Settings().extend_default_settings(__default_settings__) Settings().extend_default_settings(__default_settings__)
Registry().create() Registry().create()
self.poll = Poll() self.poll = Poller()
def tearDown(self): def tearDown(self):
""" """
@ -112,7 +113,7 @@ class TestWSServer(TestCase, TestMixin):
self.assertFalse(data['results']['isSecure'], 'The isSecure return value should be False') self.assertFalse(data['results']['isSecure'], 'The isSecure return value should be False')
self.assertFalse(data['results']['isAuthorised'], 'The isAuthorised return value should be False') self.assertFalse(data['results']['isAuthorised'], 'The isAuthorised return value should be False')
self.assertTrue(data['results']['twelve'], 'The twelve return value should be False') self.assertTrue(data['results']['twelve'], 'The twelve return value should be False')
self.assertEquals(data['results']['version'], 2, 'The version return value should be 2') self.assertEquals(data['results']['version'], 3, 'The version return value should be 3')
self.assertEquals(data['results']['slide'], 5, 'The slide return value should be 5') self.assertEquals(data['results']['slide'], 5, 'The slide return value should be 5')
self.assertEquals(data['results']['service'], 21, 'The version return value should be 21') self.assertEquals(data['results']['service'], 21, 'The version return value should be 21')
self.assertEquals(data['results']['item'], '23-34-45', 'The item return value should match 23-34-45') self.assertEquals(data['results']['item'], '23-34-45', 'The item return value should match 23-34-45')

View File

@ -25,7 +25,7 @@ Functional tests to test the Http Server Class.
from unittest import TestCase from unittest import TestCase
from openlp.core.api import HttpServer from openlp.core.api.http.server import HttpServer
from tests.functional import patch from tests.functional import patch
@ -34,8 +34,8 @@ class TestHttpServer(TestCase):
""" """
A test suite to test starting the http server A test suite to test starting the http server
""" """
@patch('openlp.core.api.http.HttpThread') @patch('openlp.core.api.http.server.HttpWorker')
@patch('openlp.core.api.http.QtCore.QThread') @patch('openlp.core.api.http.server.QtCore.QThread')
def test_serverstart(self, mock_qthread, mock_thread): def test_serverstart(self, mock_qthread, mock_thread):
""" """
Test the starting of the Waitress Server Test the starting of the Waitress Server