18 lines
832 B
Python
18 lines
832 B
Python
import unittest
|
|
from unittest.mock import patch
|
|
from server_buddy.core.startup import desktop_error
|
|
|
|
class StartupTests(unittest.TestCase):
|
|
@patch('server_buddy.core.startup.sys.platform', 'linux')
|
|
@patch.dict('os.environ', {'DISPLAY': ':0', 'QT_QPA_PLATFORM': 'xcb'}, clear=True)
|
|
@patch('server_buddy.core.startup.ctypes.CDLL', side_effect=OSError)
|
|
def test_missing_xcb_returns_install_instruction(self, loader):
|
|
self.assertIn('sudo apt install libxcb-cursor0', desktop_error())
|
|
|
|
@patch('server_buddy.core.startup.sys.platform', 'linux')
|
|
@patch.dict('os.environ', {'QT_QPA_PLATFORM': 'offscreen'}, clear=True)
|
|
@patch('server_buddy.core.startup.ctypes.CDLL')
|
|
def test_offscreen_does_not_require_xcb(self, loader):
|
|
self.assertIsNone(desktop_error())
|
|
loader.assert_not_called()
|