From df77c3ebd9dd2bbf3855f9499a027eb3e663e3f0 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 4 Mar 2017 16:51:51 +0000 Subject: [PATCH] add test --- .../openlp_plugins/remotes/test_remotetab.py | 37 ++++++++----------- .../openlp_plugins/remotes/test_router.py | 2 - tests/resources/remotes/openlp.crt | 0 tests/resources/remotes/openlp.key | 0 4 files changed, 16 insertions(+), 23 deletions(-) delete mode 100644 tests/resources/remotes/openlp.crt delete mode 100644 tests/resources/remotes/openlp.key diff --git a/tests/functional/openlp_plugins/remotes/test_remotetab.py b/tests/functional/openlp_plugins/remotes/test_remotetab.py index 76ce095fe..2dfd41aa3 100644 --- a/tests/functional/openlp_plugins/remotes/test_remotetab.py +++ b/tests/functional/openlp_plugins/remotes/test_remotetab.py @@ -83,7 +83,6 @@ class TestRemoteTab(TestCase, TestMixin): """ Test the get_ip_address function with given ip address """ - # GIVEN: A mocked location # GIVEN: An ip address given_ip = '192.168.1.1' # WHEN: the default ip address is given @@ -115,25 +114,21 @@ class TestRemoteTab(TestCase, TestMixin): self.assertEqual(self.form.user_login_group_box.isChecked(), False, 'The authentication box should not be enabled') - def test_set_certificate_urls(self): + def test_set_urls(self): """ - Test the set_urls function with certificate available + Test the set_url function to generate correct url links """ - # GIVEN: A mocked location - with patch('openlp.core.common.Settings') as mocked_class, \ - patch('openlp.core.common.applocation.AppLocation.get_directory') as mocked_get_directory, \ - patch('openlp.core.common.check_directory_exists') as mocked_check_directory_exists, \ - patch('openlp.core.common.applocation.os') as mocked_os: - # GIVEN: A mocked out Settings class and a mocked out AppLocation.get_directory() - mocked_settings = mocked_class.return_value - mocked_settings.contains.return_value = False - mocked_get_directory.return_value = TEST_PATH - mocked_check_directory_exists.return_value = True - mocked_os.path.normpath.return_value = TEST_PATH - - # WHEN: when the set_urls is called having reloaded the form. - self.form.load() - self.form.set_urls() - # THEN: the following screen values should be set - self.assertEqual(self.form.http_settings_group_box.isEnabled(), True, - 'The Http group box should be enabled') + # GIVEN: An ip address + self.form.address_edit.setText('192.168.1.1') + # WHEN: the urls are generated + self.form.set_urls() + # THEN: the following links are returned + self.assertEqual(self.form.remote_url.text(), + "http://192.168.1.1:4316/", + 'The return value should be a fully formed link') + self.assertEqual(self.form.stage_url.text(), + "http://192.168.1.1:4316/stage", + 'The return value should be a fully formed stage link') + self.assertEqual(self.form.live_url.text(), + "http://192.168.1.1:4316/main", + 'The return value should be a fully formed main link') diff --git a/tests/functional/openlp_plugins/remotes/test_router.py b/tests/functional/openlp_plugins/remotes/test_router.py index 6f1f27740..670f100de 100644 --- a/tests/functional/openlp_plugins/remotes/test_router.py +++ b/tests/functional/openlp_plugins/remotes/test_router.py @@ -35,8 +35,6 @@ from tests.helpers.testmixin import TestMixin __default_settings__ = { 'remotes/twelve hour': True, 'remotes/port': 4316, - 'remotes/https port': 4317, - 'remotes/https enabled': False, 'remotes/user id': 'openlp', 'remotes/password': 'password', 'remotes/authentication enabled': False, diff --git a/tests/resources/remotes/openlp.crt b/tests/resources/remotes/openlp.crt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/resources/remotes/openlp.key b/tests/resources/remotes/openlp.key deleted file mode 100644 index e69de29bb..000000000