From cb9ac8cde204692fcc22569f4ae217b8295bf1a0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 5 Mar 2017 17:00:21 +0000 Subject: [PATCH] fix tests --- .../openlp_core_api_http/test_http.py | 13 +++- .../openlp_core_api_http/test_init.py | 60 ------------------- 2 files changed, 11 insertions(+), 62 deletions(-) delete mode 100644 tests/functional/openlp_core_api_http/test_init.py diff --git a/tests/functional/openlp_core_api_http/test_http.py b/tests/functional/openlp_core_api_http/test_http.py index 59fdfda20..fe7fe2b65 100644 --- a/tests/functional/openlp_core_api_http/test_http.py +++ b/tests/functional/openlp_core_api_http/test_http.py @@ -25,18 +25,27 @@ Functional tests to test the Http Server Class. from unittest import TestCase +from openlp.core.common import Registry from openlp.core.api.http.server import HttpServer -from tests.functional import patch +from tests.functional import patch, MagicMock class TestHttpServer(TestCase): """ A test suite to test starting the http server """ + + def setUp(self): + """ + Create the UI + """ + Registry().create() + Registry().register('service_list', MagicMock()) + @patch('openlp.core.api.http.server.HttpWorker') @patch('openlp.core.api.http.server.QtCore.QThread') - def test_serverstart(self, mock_qthread, mock_thread): + def test_server_start(self, mock_qthread, mock_thread): """ Test the starting of the Waitress Server """ diff --git a/tests/functional/openlp_core_api_http/test_init.py b/tests/functional/openlp_core_api_http/test_init.py deleted file mode 100644 index 3189c06bf..000000000 --- a/tests/functional/openlp_core_api_http/test_init.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2017 OpenLP Developers # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### -""" -Functional tests to test the Http Server Class. -""" - -from unittest import TestCase - -from openlp.core.common import Registry -from openlp.core.api.http.server import HttpServer - -from tests.functional import patch, MagicMock - - -class TestHttpServer(TestCase): - """ - A test suite to test starting the http server - """ - - def setUp(self): - """ - Create the UI - """ - Registry().create() - Registry().register('service_list', MagicMock()) - - - - @patch('openlp.core.api.http.server.HttpWorker') - @patch('openlp.core.api.http.server.QtCore.QThread') - def test_serverstart(self, mock_qthread, mock_thread): - """ - Test the starting of the Waitress Server - """ - # GIVEN: A new httpserver - # WHEN: I start the server - server = HttpServer() - - # THEN: the api environment should have been created - self.assertEquals(1, mock_qthread.call_count, 'The qthread should have been called once') - self.assertEquals(1, mock_thread.call_count, 'The http thread should have been called once')