forked from openlp/openlp
Remove the class, makes the tests run faster.
This commit is contained in:
parent
5e765252b6
commit
b9cf077b36
@ -29,11 +29,7 @@ from openlp.plugins.presentations.lib.libreofficeserver import LibreOfficeServer
|
||||
from tests.functional import MagicMock, patch, call
|
||||
|
||||
|
||||
class TestLibreOfficeServer(TestCase):
|
||||
"""
|
||||
Test the LibreOfficeServer Class
|
||||
"""
|
||||
def test_constructor(self):
|
||||
def test_constructor():
|
||||
"""
|
||||
Test the Constructor from the server
|
||||
"""
|
||||
@ -48,8 +44,8 @@ class TestLibreOfficeServer(TestCase):
|
||||
assert server._presentation is None
|
||||
assert server._process is None
|
||||
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.Popen')
|
||||
def test_start_process(self, MockedPopen):
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.Popen')
|
||||
def test_start_process(MockedPopen):
|
||||
"""
|
||||
Test that the correct command is issued to run LibreOffice
|
||||
"""
|
||||
@ -73,8 +69,8 @@ class TestLibreOfficeServer(TestCase):
|
||||
])
|
||||
assert server._process is mocked_process
|
||||
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.uno')
|
||||
def test_setup_desktop(self, mocked_uno):
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.uno')
|
||||
def test_setup_desktop(mocked_uno):
|
||||
"""
|
||||
Test that setting up the desktop works correctly
|
||||
"""
|
||||
@ -98,20 +94,18 @@ class TestLibreOfficeServer(TestCase):
|
||||
mocked_uno.getComponentContext.assert_called_once_with()
|
||||
mocked_context.ServiceManager.createInstanceWithContext.assert_called_once_with(
|
||||
'com.sun.star.bridge.UnoUrlResolver', mocked_context)
|
||||
self.assertEqual(
|
||||
[
|
||||
expected_calls = [
|
||||
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext'),
|
||||
call('uno:pipe,name=openlp_pipe;urp;StarOffice.ComponentContext')
|
||||
],
|
||||
mocked_resolver.resolve.call_args_list
|
||||
)
|
||||
]
|
||||
assert mocked_resolver.resolve.call_args_list == expected_calls
|
||||
MockedServiceManager.createInstanceWithContext.assert_called_once_with(
|
||||
'com.sun.star.frame.Desktop', mocked_uno_instance)
|
||||
assert server._manager is MockedServiceManager
|
||||
assert server._desktop is mocked_desktop
|
||||
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.PropertyValue')
|
||||
def test_create_property(self, MockedPropertyValue):
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.PropertyValue')
|
||||
def test_create_property(MockedPropertyValue):
|
||||
"""
|
||||
Test that the _create_property() method works correctly
|
||||
"""
|
||||
@ -127,7 +121,7 @@ class TestLibreOfficeServer(TestCase):
|
||||
assert prop.Name == name
|
||||
assert prop.Value == value
|
||||
|
||||
def test_get_text_from_page_slide_text(self):
|
||||
def test_get_text_from_page_slide_text():
|
||||
"""
|
||||
Test that the _get_text_from_page() method gives us nothing for slide text
|
||||
"""
|
||||
@ -153,7 +147,7 @@ class TestLibreOfficeServer(TestCase):
|
||||
# THE: The text is correct
|
||||
assert text == 'Page Text\n'
|
||||
|
||||
def test_get_text_from_page_title(self):
|
||||
def test_get_text_from_page_title():
|
||||
"""
|
||||
Test that the _get_text_from_page() method gives us the text from the titles
|
||||
"""
|
||||
@ -179,7 +173,7 @@ class TestLibreOfficeServer(TestCase):
|
||||
# THEN: The text should be correct
|
||||
assert text == 'Page Title\n'
|
||||
|
||||
def test_get_text_from_page_notes(self):
|
||||
def test_get_text_from_page_notes():
|
||||
"""
|
||||
Test that the _get_text_from_page() method gives us the text from the notes
|
||||
"""
|
||||
@ -207,7 +201,7 @@ class TestLibreOfficeServer(TestCase):
|
||||
# THEN: The text should be correct
|
||||
assert text == 'Page Notes\n'
|
||||
|
||||
def test_has_desktop_no_desktop(self):
|
||||
def test_has_desktop_no_desktop():
|
||||
"""
|
||||
Test the has_desktop() method when there's no desktop
|
||||
"""
|
||||
@ -220,7 +214,7 @@ class TestLibreOfficeServer(TestCase):
|
||||
# THEN: The result should be False
|
||||
assert result is False
|
||||
|
||||
def test_has_desktop(self):
|
||||
def test_has_desktop():
|
||||
"""
|
||||
Test the has_desktop() method
|
||||
"""
|
||||
@ -234,7 +228,7 @@ class TestLibreOfficeServer(TestCase):
|
||||
# THEN: The result should be True
|
||||
assert result is True
|
||||
|
||||
def test_shutdown(self):
|
||||
def test_shutdown():
|
||||
"""
|
||||
Test the shutdown method
|
||||
"""
|
||||
@ -272,8 +266,8 @@ class TestLibreOfficeServer(TestCase):
|
||||
mocked_desktop.terminate.assert_called_once_with()
|
||||
server._process.kill.assert_called_once_with()
|
||||
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.uno')
|
||||
def test_load_presentation(self, mocked_uno):
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.uno')
|
||||
def test_load_presentation(mocked_uno):
|
||||
"""
|
||||
Test the load_presentation() method
|
||||
"""
|
||||
@ -306,9 +300,9 @@ class TestLibreOfficeServer(TestCase):
|
||||
assert server._presentation.Display == screen_number
|
||||
assert server._control is None
|
||||
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.uno')
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.os')
|
||||
def test_extract_thumbnails(self, mocked_os, mocked_uno):
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.uno')
|
||||
@patch('openlp.plugins.presentations.lib.libreofficeserver.os')
|
||||
def test_extract_thumbnails(mocked_os, mocked_uno):
|
||||
"""
|
||||
Test the extract_thumbnails() method
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user