Test case for Settings dialog

This commit is contained in:
Dmitri Bogomolov 2020-06-16 22:37:11 +03:00
parent cb0710e454
commit db285a0186
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 46 additions and 1 deletions

View File

@ -1,6 +1,7 @@
"""bitmessageqt tests"""
from main import TestMain, TestUISignaler
from settings import TestSettings
from support import TestSupport
__all__ = ["TestMain", "TestSupport", "TestUISignaler"]
__all__ = ["TestMain", "TestSettings", "TestSupport", "TestUISignaler"]

View File

@ -0,0 +1,44 @@
from PyQt4 import QtCore, QtTest
import state
from bmconfigparser import BMConfigParser
from bitmessageqt import settings
from main import TestBase
class TestSettings(TestBase):
"""A test case for the "Settings" dialog"""
def test_dontconnect(self):
"""Check that Settings dialog doesn't remove dontconnect"""
BMConfigParser().set('bitmessagesettings', 'dontconnect', 'true')
QtTest.QTest.qSleep(5005)
self.assertEqual(state.statusIconColor, 'red')
self.assertEqual(
BMConfigParser().safeGet(
'bitmessagesettings', 'socksproxytype'), 'none')
# self.window.ui.actionSettings.trigger()
# dialog = self.app.activeWindow()
# self.assertIsInstance(dialog, settings.SettingsDialog)
dialog = settings.SettingsDialog(self.window)
dialog.comboBoxProxyType.setCurrentIndex(2)
# Accept later
QtCore.QTimer.singleShot(
1, lambda:
QtTest.QTest.mouseClick(
dialog.buttonBox.button(dialog.buttonBox.Ok),
QtCore.Qt.LeftButton)
)
dialog.exec_()
self.assertFalse(dialog.net_restart_needed)
# QtTest.QTest.mouseClick(dialog.checkBoxUPnP, QtCore.Qt.LeftButton)
# QtTest.QTest.mouseClick(dialog.buttonBox.button(dialog.buttonBox.Ok), QtCore.Qt.LeftButton)
self.assertEqual(
BMConfigParser().safeGet(
'bitmessagesettings', 'socksproxytype'), 'SOCKS5')
QtTest.QTest.qSleep(5050)
self.assertTrue(
BMConfigParser().safeGetBoolean(
'bitmessagesettings', 'dontconnect'))