diff --git a/tests/functional/openlp_core_api/test_httpserver.py b/tests/functional/openlp_core_api/test_httpserver.py index f294d1afa..8ba8bd1b2 100644 --- a/tests/functional/openlp_core_api/test_httpserver.py +++ b/tests/functional/openlp_core_api/test_httpserver.py @@ -36,7 +36,7 @@ class TestHttpServer(TestCase): """ @patch('openlp.core.api.httpserver.HttpThread') @patch('openlp.core.api.httpserver.QtCore.QThread') - def test_bootstrap(self, mock_qthread, mock_thread): + def test_serverstart(self, mock_qthread, mock_thread): """ Test the starting of the Waitress Server """ diff --git a/tests/functional/openlp_core_api/test_wsserver.py b/tests/functional/openlp_core_api/test_wsserver.py new file mode 100644 index 000000000..e3402cc8e --- /dev/null +++ b/tests/functional/openlp_core_api/test_wsserver.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2016 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.api import OpenLPWSServer + +from tests.functional import patch + + +class TestWSServer(TestCase): + """ + A test suite to test starting the websocket server + """ + @patch('openlp.core.api.wsserver.WSThread') + @patch('openlp.core.api.wsserver.QtCore.QThread') + def test_serverstart(self, mock_qthread, mock_thread): + """ + Test the starting of the WebSockets Server + """ + # GIVEN: A new httpserver + # WHEN: I start the server + server = OpenLPWSServer() + + # 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')