Qt test for UDP setting
This commit is contained in:
parent
79efacffb1
commit
6f9b66ddff
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
from addressbook import TestAddressbook
|
from addressbook import TestAddressbook
|
||||||
from main import TestMain, TestUISignaler
|
from main import TestMain, TestUISignaler
|
||||||
|
from settings import TestSettings
|
||||||
from support import TestSupport
|
from support import TestSupport
|
||||||
|
|
||||||
__all__ = ["TestAddressbook", "TestMain", "TestSupport", "TestUISignaler"]
|
__all__ = [
|
||||||
|
"TestAddressbook", "TestMain", "TestSettings", "TestSupport",
|
||||||
|
"TestUISignaler"
|
||||||
|
]
|
||||||
|
|
34
src/bitmessageqt/tests/settings.py
Normal file
34
src/bitmessageqt/tests/settings.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
|
from main import TestBase
|
||||||
|
from bmconfigparser import BMConfigParser
|
||||||
|
from bitmessageqt import settings
|
||||||
|
|
||||||
|
|
||||||
|
class TestSettings(TestBase):
|
||||||
|
"""A test case for the "Settings" dialog"""
|
||||||
|
def setUp(self):
|
||||||
|
super(TestSettings, self).setUp()
|
||||||
|
self.dialog = settings.SettingsDialog(self.window)
|
||||||
|
|
||||||
|
def test_udp(self):
|
||||||
|
"""Test the effect of checkBoxUDP"""
|
||||||
|
udp_setting = BMConfigParser().safeGetBoolean(
|
||||||
|
'bitmessagesettings', 'udp')
|
||||||
|
self.assertEqual(udp_setting, self.dialog.checkBoxUDP.isChecked())
|
||||||
|
self.dialog.checkBoxUDP.setChecked(not udp_setting)
|
||||||
|
self.dialog.accept()
|
||||||
|
self.assertEqual(
|
||||||
|
not udp_setting,
|
||||||
|
BMConfigParser().safeGetBoolean('bitmessagesettings', 'udp'))
|
||||||
|
time.sleep(5)
|
||||||
|
for thread in threading.enumerate():
|
||||||
|
if thread.name == 'Announcer': # find Announcer thread
|
||||||
|
if udp_setting:
|
||||||
|
self.fail(
|
||||||
|
'Announcer thread is running while udp set to False')
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
if not udp_setting:
|
||||||
|
self.fail('No Announcer thread found while udp set to True')
|
Reference in New Issue
Block a user