This commit is contained in:
Tim Bentley 2017-03-04 16:51:51 +00:00
parent 0e54621999
commit df77c3ebd9
4 changed files with 16 additions and 23 deletions

View File

@ -83,7 +83,6 @@ class TestRemoteTab(TestCase, TestMixin):
""" """
Test the get_ip_address function with given ip address Test the get_ip_address function with given ip address
""" """
# GIVEN: A mocked location
# GIVEN: An ip address # GIVEN: An ip address
given_ip = '192.168.1.1' given_ip = '192.168.1.1'
# WHEN: the default ip address is given # 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, self.assertEqual(self.form.user_login_group_box.isChecked(), False,
'The authentication box should not be enabled') '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 # GIVEN: An ip address
with patch('openlp.core.common.Settings') as mocked_class, \ self.form.address_edit.setText('192.168.1.1')
patch('openlp.core.common.applocation.AppLocation.get_directory') as mocked_get_directory, \ # WHEN: the urls are generated
patch('openlp.core.common.check_directory_exists') as mocked_check_directory_exists, \ self.form.set_urls()
patch('openlp.core.common.applocation.os') as mocked_os: # THEN: the following links are returned
# GIVEN: A mocked out Settings class and a mocked out AppLocation.get_directory() self.assertEqual(self.form.remote_url.text(),
mocked_settings = mocked_class.return_value "<a href=\"http://192.168.1.1:4316/\">http://192.168.1.1:4316/</a>",
mocked_settings.contains.return_value = False 'The return value should be a fully formed link')
mocked_get_directory.return_value = TEST_PATH self.assertEqual(self.form.stage_url.text(),
mocked_check_directory_exists.return_value = True "<a href=\"http://192.168.1.1:4316/stage\">http://192.168.1.1:4316/stage</a>",
mocked_os.path.normpath.return_value = TEST_PATH 'The return value should be a fully formed stage link')
self.assertEqual(self.form.live_url.text(),
# WHEN: when the set_urls is called having reloaded the form. "<a href=\"http://192.168.1.1:4316/main\">http://192.168.1.1:4316/main</a>",
self.form.load() 'The return value should be a fully formed main link')
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')

View File

@ -35,8 +35,6 @@ from tests.helpers.testmixin import TestMixin
__default_settings__ = { __default_settings__ = {
'remotes/twelve hour': True, 'remotes/twelve hour': True,
'remotes/port': 4316, 'remotes/port': 4316,
'remotes/https port': 4317,
'remotes/https enabled': False,
'remotes/user id': 'openlp', 'remotes/user id': 'openlp',
'remotes/password': 'password', 'remotes/password': 'password',
'remotes/authentication enabled': False, 'remotes/authentication enabled': False,