Graphical Qt Tests

This commit is contained in:
lakshyacis 2020-02-26 16:24:49 +05:30
parent 32bb2a6e44
commit 6b0ce5d1ae
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
15 changed files with 613 additions and 10 deletions

View File

@ -1617,6 +1617,9 @@ class MyForm(settingsmixin.SMainWindow):
def showConnectDialog(self):
dialog = dialogs.ConnectDialog(self)
if state.qttesting:
from graphicaltesting import test_appstart
test_appstart.connectme(dialog)
if dialog.exec_():
if dialog.radioButtonConnectNow.isChecked():
BMConfigParser().remove_option(
@ -4160,4 +4163,8 @@ def run():
if not BMConfigParser().getboolean('bitmessagesettings', 'startintray'):
myapp.show()
if state.qttesting:
from graphicaltesting import testinitialization
testinitialization.test_initialize(myapp)
sys.exit(app.exec_())

View File

@ -499,16 +499,23 @@ class SettingsDialog(QtGui.QDialog):
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000:
# If the time period is less than 5 hours, we give
# zero values to all fields. No message will be sent again.
QtGui.QMessageBox.about(
self,
_translate("MainWindow", "Will not resend ever"),
_translate(
"MainWindow",
"Note that the time limit you entered is less"
" than the amount of time Bitmessage waits for"
" the first resend attempt therefore your"
" messages will never be resent.")
)
if state.qttesting:
print(
"Note that the time limit you entered is less than the amount"
" of time Bitmessage waits for the first resend attempt therefore"
" your messages will never be resent."
)
else:
QtGui.QMessageBox.about(
self,
_translate("MainWindow", "Will not resend ever"),
_translate(
"MainWindow",
"Note that the time limit you entered is less"
" than the amount of time Bitmessage waits for"
" the first resend attempt therefore your"
" messages will never be resent.")
)
self.config.set(
'bitmessagesettings', 'stopresendingafterxdays', '0')
self.config.set(

View File

View File

@ -0,0 +1,88 @@
from random import choice
from string import ascii_lowercase
from PyQt4.QtTest import QTest
from bitmessageqt import address_dialogs
from bmconfigparser import BMConfigParser
from testloader import BitmessageTestCase
class BitmessageTest_AddressGeneration(BitmessageTestCase):
"""Testing Environment"""
def test_generateaddress(self):
"""Method clicks on new label pushbutton and create new address with random label"""
QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(500)
try:
random_label = ""
self.myapp.ui.pushButtonNewAddress.setStyleSheet("QPushButton {background-color: #FF5733; color: white;}")
QTest.qWait(50)
self.myapp.ui.pushButtonNewAddress.setStyleSheet("")
label_gen_obj = address_dialogs.NewAddressDialog()
QTest.qWait(500)
address_count = len(BMConfigParser().addresses())
QTest.qWait(400)
for _ in range(12):
random_label = random_label + choice(ascii_lowercase)
label_gen_obj.newaddresslabel.setText(random_label)
QTest.qWait(5)
QTest.qWait(500)
label_gen_obj.accept()
QTest.qWait(800)
self.assertEqual(len(BMConfigParser().addresses()), address_count + 1)
self.assertEqual(str(BMConfigParser().get(BMConfigParser().addresses()[-1], "label")), random_label)
print("\n Test Pass :--> Address Generated Successfully \n")
self.assertTrue(True, " \n Test Pass :--> Address Generated Successfully")
return 1 # if every thing is ok
except:
print("\n Test Fail :--> Address Generatation Failed or Taking too much time to generate address \n")
self.assertTrue(False, " \n Test Fail :--> Address Generation Failed!")
return 0 # if test fail
def test_generateaddresswithpassphrase(self):
"""Clicks on the create new label with passphrase pushbutton and generates 8 address"""
QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(500)
try:
random_password1, random_password2 = "", ""
self.myapp.ui.pushButtonNewAddress.setStyleSheet("QPushButton {background-color: #FF5733; color: white;}")
QTest.qWait(50)
self.myapp.ui.pushButtonNewAddress.setStyleSheet("")
label_gen_obj = address_dialogs.NewAddressDialog()
QTest.qWait(500)
address_count = len(BMConfigParser().addresses())
QTest.qWait(400)
label_gen_obj.radioButtonDeterministicAddress.click()
QTest.qWait(400)
for i in range(15):
random_password1 += choice(ascii_lowercase)
label_gen_obj.lineEditPassphrase.setText(random_password1)
QTest.qWait(5)
QTest.qWait(500)
for i in random_password1:
random_password2 += i
label_gen_obj.lineEditPassphraseAgain.setText(random_password2)
QTest.qWait(5)
QTest.qWait(800)
label_gen_obj.accept()
self.assertEqual(random_password1, random_password2)
print(" Creating Address ......")
QTest.qWait(3000)
print(" Please Wait.! Creating 8 Address ......")
QTest.qWait(3000)
self.assertEqual(len(BMConfigParser().addresses()), address_count + 8)
QTest.qWait(100)
print("\n Test Pass :--> Address Generated Successfully with passphrase \n")
self.assertTrue(True, " \n Test Pass :--> Address Generated Successfully with passphrase")
return 1
except:
QTest.qWait(100)
print(
"\n Test Fail :--> Address Generatation Failed with passphrase"
" or Taking too much time to generate address \n")
self.assertTrue(False, " \n Test Fail :--> Address Generatation Failed with passphrase")
return 0

View File

@ -0,0 +1,68 @@
from random import choice
from string import ascii_lowercase
from PyQt4 import QtCore, QtGui
from PyQt4.QtTest import QTest
import shared
from bitmessageqt import dialogs
from bmconfigparser import BMConfigParser
from helper_sql import sqlQuery
from testloader import BitmessageTestCase
class BitmessageTest_AddSubscription(BitmessageTestCase):
def test_subscription(self):
"""Test for subscription functionality"""
QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.subscriptions)
QTest.qWait(500)
if BMConfigParser().addresses():
try:
self.dialog = dialogs.NewSubscriptionDialog(self.myapp)
self.dialog.show()
QTest.qWait(800)
random_label = ""
for _ in range(30):
random_label += choice(ascii_lowercase)
self.dialog.lineEditLabel.setText(random_label)
QTest.qWait(5)
QTest.qWait(500)
rand_address = choice(BMConfigParser().addresses())
random_address = ""
for x in range(len(rand_address)):
random_address += rand_address[x]
self.dialog.lineEditAddress.setText(random_address)
QTest.qWait(5)
QTest.qWait(500)
QtCore.QTimer.singleShot(0, self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked)
try:
QTest.qWait(800)
address, label = self.dialog.data
except AttributeError:
QTest.qWait(500)
print("\n Test Fail :--> Error, While Creating subscription list. \n")
return 0
if shared.isAddressInMySubscriptionsList(address):
print(
"\n Test Fail :--> You cannot add the same address to your subscriptions twice."
" Perhaps rename the existing one if you want. \n")
QTest.qWait(500)
return 0
self.myapp.addSubscription(address, label)
sub_add = sqlQuery("select address from subscriptions where label='" + random_label + "'")[0]
self.assertEqual(random_address, sub_add[0])
print("\n Test Pass :--> Subscription Done Successfully! \n")
QTest.qWait(100)
self.assertTrue(True, " \n Test Pass :--> Subscription Done Successfully!")
return 1
except:
QTest.qWait(100)
print("\n Test Fail :--> Error Occured while adding address to subscription list! \n")
self.assertTrue(False, " \n Test Fail :--> Error Occured while adding address to subscription list! ")
return 0
else:
QTest.qWait(100)
print("\n Test Fail :--> No Address Found! \n")
self.assertTrue(False, " \n Test Fail :--> No Address Found!")
return 0

View File

@ -0,0 +1,9 @@
from PyQt4 import QtCore, QtGui
from PyQt4.QtTest import QTest
def connectme(dialog):
"""Automate the connect dialog, when run for first time"""
dialog.show()
QTest.qWait(1200)
QtCore.QTimer.singleShot(0, dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked)

View File

@ -0,0 +1,108 @@
from random import choice
from string import ascii_lowercase
from PyQt4 import QtCore, QtGui
from PyQt4.QtTest import QTest
from addresses import addBMIfNotPresent
from bitmessageqt import blacklist
from bitmessageqt.dialogs import AddAddressDialog
from bitmessageqt.utils import avatarize
from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlQuery
from testloader import BitmessageTestCase
from tr import _translate
class BitmessageTest_BlackandWhiteList(BitmessageTestCase):
"""Blacklist and Whitelist address add functionality tests"""
def test_blackwhitelist(self):
"""Tab switch to blacklist and add the address on blacklist and whitelist"""
QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.blackwhitelist)
QTest.qWait(500)
try:
self.blacklist_obj = blacklist.Blacklist()
self.dialog = AddAddressDialog(self.myapp)
blacklistcount = len(sqlQuery("Select * from blacklist"))
self.myapp.ui.blackwhitelist.radioButtonBlacklist.click()
self.checkblacklist(self.myapp)
QTest.qWait(500)
self.assertEqual(blacklistcount + 1, len(sqlQuery("Select * from blacklist")))
whitelistcount = len(sqlQuery("Select * from whitelist"))
self.myapp.ui.blackwhitelist.radioButtonWhitelist.click()
self.checkblacklist(self.myapp)
QTest.qWait(500)
self.assertEqual(whitelistcount + 1, len(sqlQuery("Select * from whitelist")))
except:
pass
def checkblacklist(self, myapp):
# pylint: disable=too-many-statements
QTest.qWait(1000)
self.dialog.lineEditLabel.setText("")
self.dialog.lineEditAddress.setText("")
self.dialog.show()
QTest.qWait(800)
random_label = ""
for _ in range(30):
random_label += choice(ascii_lowercase)
self.dialog.lineEditLabel.setText(random_label)
QTest.qWait(5)
QTest.qWait(500)
rand_address = choice(BMConfigParser().addresses())
random_address = ""
for x in range(len(rand_address)):
random_address += rand_address[x]
self.dialog.lineEditAddress.setText(random_address)
QTest.qWait(5)
QTest.qWait(500)
QtCore.QTimer.singleShot(0, self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked)
if self.dialog.labelAddressCheck.text() == _translate("MainWindow", "Address is valid."):
address = addBMIfNotPresent(str(self.dialog.lineEditAddress.text()))
t = (address,)
if BMConfigParser().get("bitmessagesettings", "blackwhitelist") == "black":
sql = """select * from blacklist where address=?"""
else:
sql = """select * from whitelist where address=?"""
queryreturn = sqlQuery(sql, *t)
if queryreturn == []:
self.blacklist_obj.tableWidgetBlacklist.setSortingEnabled(False)
self.blacklist_obj.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(self.dialog.lineEditLabel.text().toUtf8(), "utf-8"))
newItem.setIcon(avatarize(address))
self.blacklist_obj.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.blacklist_obj.tableWidgetBlacklist.setItem(0, 1, newItem)
self.blacklist_obj.tableWidgetBlacklist.setSortingEnabled(True)
t = (str(self.dialog.lineEditLabel.text().toUtf8()), address, True)
if BMConfigParser().get("bitmessagesettings", "blackwhitelist") == "black":
sql = """INSERT INTO blacklist VALUES (?,?,?)"""
sqlExecute(sql, *t)
black_list_value = sqlQuery("Select address from blacklist where label='" + random_label + "'")[0]
print("\n Test Pass :--> Address Added to the blacklist! \n")
self.assertEqual(black_list_value[0], random_address)
return
else:
sql = """INSERT INTO whitelist VALUES (?,?,?)"""
sqlExecute(sql, *t)
white_list_value = sqlQuery("Select address from whitelist where label='" + random_label + "'")[0]
print("\n Test Pass :--> Address Added to the whitelist! \n")
self.assertEqual(white_list_value[0], random_address)
return
else:
QTest.qWait(100)
print(
"\n Test Fail :--> You cannot add the same address to your list twice."
" Perhaps rename the existing one if you want. \n")
self.assertTrue(
False, "\n Test Fail :--> You cannot add the same address to your list twice."
" Perhaps rename the existing one if you want.")
return 0
else:
QTest.qWait(100)
print("\n Test Fail :--> The address you entered was invalid. Ignoring it. \n")
self.assertTrue(False, " \n Test Fail :--> The address you entered was invalid. Ignoring it.")
return 0

View File

@ -0,0 +1,14 @@
from PyQt4.QtTest import QTest
from testloader import BitmessageTestCase
class BitmessageTest_ChansTest(BitmessageTestCase):
def test_chans(self):
"""Switch to chans window and test"""
QTest.qWait(1200)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.chans)
# QTest.mouseClick(self.myapp.ui.pushButtonAddChan, Qt.LeftButton)
# self.assertEqual('foo'.upper(), 'F00')
print("\n Test Pass :--> Chans Test Passed! \n")
return 1

View File

@ -0,0 +1,74 @@
import random
from random import choice
from string import ascii_lowercase
from PyQt4.QtCore import Qt
from PyQt4.QtTest import QTest
from bmconfigparser import BMConfigParser
from helper_sql import sqlQuery
from testloader import BitmessageTestCase
class BitmessageTest_MessageTesting(BitmessageTestCase):
"""Test Message Sending functionality"""
def test_msgsend(self):
"""Auto-fill senders address, receivers address, subject and message and sends the message"""
try:
if BMConfigParser().addresses():
QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.send)
QTest.qWait(800)
self.myapp.ui.comboBoxSendFrom.setCurrentIndex(
random.randrange(1, len(BMConfigParser().addresses()) + 1)
)
QTest.qWait(800)
rand_address = choice(BMConfigParser().addresses())
random_address = ""
for x in range(len(rand_address)):
random_address += rand_address[x]
self.myapp.ui.lineEditTo.setText(random_address)
QTest.qWait(1)
QTest.qWait(800)
random_subject = ""
for x in range(40):
random_subject += choice(ascii_lowercase)
self.myapp.ui.lineEditSubject.setText(random_subject)
QTest.qWait(1)
QTest.qWait(800)
random_message = ""
for x in range(200):
random_message += choice(ascii_lowercase)
self.myapp.ui.textEditMessage.setText(random_message)
QTest.qWait(1)
QTest.qWait(800)
inbox_length = len(sqlQuery("Select msgid from inbox"))
QTest.mouseClick(self.myapp.ui.pushButtonSend, Qt.LeftButton)
QTest.qWait(600)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
print(" .......................... waiting for message .......................... ")
for x in range(5):
QTest.qWait(5000)
print(" waiting " + x * ".")
self.assertEqual(sqlQuery("Select toaddress,subject from inbox")[-1], (rand_address, random_subject))
if len(sqlQuery("Select msgid from inbox")) == inbox_length + 1:
QTest.qWait(100)
print("\n Test Pass :--> Message Received Successfully \n")
self.assertTrue(True, " Test Pass :--> Message Received Successfully")
return 1
else:
QTest.qWait(100)
print("\n Test Fail :--> Doesn't Receive Any Message!! \n")
self.assertTrue(False, " \n Test Fail :--> Doesn't Receive Any Message!!")
return 0
else:
QTest.qWait(100)
print("\n Test Fail :--> No Address Found!! \n")
self.assertTrue(False, " \n Test Fail :--> No Address Found!!")
return 0
except:
QTest.qWait(100)
print("\n Test Fail :--> Message Sending Test Fail!! \n")
self.assertTrue(False, " \n Test Fail :--> Message Sending Test Fail!!")
return 0

View File

@ -0,0 +1,13 @@
from PyQt4.QtTest import QTest
from testloader import BitmessageTestCase
class BitmessageTest_NetworkTest(BitmessageTestCase):
def test_network(self):
"""Switch to network window and test"""
QTest.qWait(1000)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.networkstatus)
QTest.qWait(1200)
print("\n Test Pass :--> Network Functionality Working Well! \n")
return 1

View File

@ -0,0 +1,158 @@
import random
from random import choice
from string import ascii_lowercase
from PyQt4 import QtGui
from PyQt4.QtCore import Qt
from PyQt4.QtTest import QTest
from bitmessageqt import dialogs
from testloader import BitmessageTestCase
class BitmessageTest_SettingWindowTest(BitmessageTestCase):
def test_settingwindow(self):
"""Triggers the setting window"""
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(1700)
dialog = dialogs.SettingsDialog(self.myapp, firstrun=self.myapp._firstrun)
self.language_change(dialog)
QTest.qWait(300)
self.eng_convert(dialog)
QTest.qWait(300)
self.network_setting_window(dialog)
QTest.qWait(300)
self.tabresendsexpire_window(dialog)
QTest.qWait(300)
def language_change(self, dialog):
"""Function that changes the language of the application"""
try:
"""Change language"""
dialog.show()
dialog.tabWidgetSettings.setCurrentIndex(dialog.tabWidgetSettings.indexOf(dialog.tabUserInterface))
QTest.qWait(800)
dialog.languageComboBox.setStyleSheet("QComboBox {background-color: #FF5733; color: white;}")
QTest.qWait(50)
dialog.languageComboBox.setStyleSheet("")
dialog.languageComboBox.setCurrentIndex(random.randint(1, 17))
QTest.qWait(1000)
ok_btn = dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok)
QTest.mouseClick(ok_btn, Qt.LeftButton)
print("\n Test Pass :--> Language Changed Successfully \n")
self.assertTrue(True, " \n Test Pass :--> Language Changed Successfully ")
return 1
except:
print("\n Test Fail :--> Error while changing Language! \n")
self.assertTrue(False, " \n Test Fail :--> Error while changing Language!")
return 0
def eng_convert(self, dialog):
"""Convert any language to english, testing just for good readability"""
try:
dialog.show()
dialog.tabWidgetSettings.setCurrentIndex(dialog.tabWidgetSettings.indexOf(dialog.tabUserInterface))
QTest.qWait(800)
dialog.languageComboBox.setStyleSheet("QComboBox {background-color: #FF5733; color: white;}")
QTest.qWait(50)
dialog.languageComboBox.setStyleSheet("")
dialog.languageComboBox.setCurrentIndex(6)
QTest.qWait(1000)
ok_btn = dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok)
QTest.mouseClick(ok_btn, Qt.LeftButton)
print("\n Test Pass :--> language changed to English Again \n")
self.assertTrue(True, " \n Test Pass :--> language changed to English Again ")
return 1
except:
print("\n Test Fail :--> Not able to change the language to English Again! Error! \n")
self.assertTrue(False, " \n Test Fail :--> Not able to change the language to English Again! Error!")
return 0
def network_setting_window(self, dialog):
"""Test for Network setting window"""
try:
dialog.show()
QTest.qWait(300)
dialog.tabWidgetSettings.setCurrentIndex(dialog.tabWidgetSettings.indexOf(dialog.tabNetworkSettings))
QTest.qWait(500)
dialog.lineEditSocksHostname.setText("")
dialog.lineEditSocksPort.setText("")
dialog.lineEditSocksUsername.setText("")
dialog.lineEditSocksPassword.setText("")
if dialog.checkBoxAuthentication.isChecked():
dialog.checkBoxAuthentication.click()
if dialog.checkBoxSocksListen.isChecked():
dialog.checkBoxSocksListen.click()
if dialog.checkBoxOnionOnly.isChecked():
dialog.checkBoxOnionOnly.click()
QTest.qWait(500)
dialog.comboBoxProxyType.setCurrentIndex(random.randint(1, 3))
QTest.qWait(800)
random_val = ""
for _ in range(10):
random_val += choice(ascii_lowercase)
dialog.lineEditSocksHostname.setText(random_val)
QTest.qWait(5)
QTest.qWait(500)
dialog.lineEditSocksPort.setText(str(random.randint(1000, 9999)))
QTest.qWait(800)
if dialog.checkBoxAuthentication.isChecked():
pass
else:
dialog.checkBoxAuthentication.click()
QTest.qWait(500)
dialog.lineEditSocksUsername.setText("".join(choice(ascii_lowercase) for i in range(10)))
QTest.qWait(500)
dialog.lineEditSocksPassword.setText("".join(choice(ascii_lowercase) for i in range(10)))
QTest.qWait(500)
if dialog.checkBoxSocksListen.isChecked():
pass
else:
dialog.checkBoxSocksListen.click()
QTest.qWait(1200)
if dialog.checkBoxOnionOnly.isChecked():
pass
else:
dialog.checkBoxOnionOnly.click()
QTest.qWait(1200)
ok_btn = dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok)
QTest.mouseClick(ok_btn, Qt.LeftButton)
print("\n Test Pass :--> Successfully tested Network setting window \n")
self.assertTrue(True, " \n Test Pass :--> Successfully tested Network setting window ")
return 1
except:
print("\n Test Fail :--> Error while testing Network setting window! \n")
self.assertTrue(False, " \n Test Fail :--> Error while testing Network setting window!")
return 0
def tabresendsexpire_window(self, dialog):
"""Testing for resend expire window"""
try:
dialog.lineEditDays.setText("")
dialog.lineEditMonths.setText("")
dialog.show()
QTest.qWait(300)
dialog.tabWidgetSettings.setCurrentIndex(dialog.tabWidgetSettings.indexOf(dialog.tabResendsExpire))
QTest.qWait(500)
QTest.qWait(500)
dialog.lineEditDays.setText(str(random.randint(0, 30)))
QTest.qWait(800)
dialog.lineEditMonths.setText(str(random.randint(0, 12)))
QTest.qWait(800)
ok_btn = dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok)
QTest.mouseClick(ok_btn, Qt.LeftButton)
print("\n Test Pass :--> Test successfull. \n")
self.assertTrue(True, " \n Test Pass :--> Test successfull. ")
return 1
except:
print("\n Test Fail :--> Tab Resend Exprire! \n")
self.assertTrue(False, " \n Test Fail :--> Tab Resend Exprire! ")
return 0

View File

@ -0,0 +1,30 @@
import unittest
import test_addressgeneration
import test_addsubscription
import test_blackwhitelist
import test_chans
import test_messagesend
import test_networkstatus
import test_settingwindow
from testloader import BitmessageTestCase
def test_initialize(myapp):
"""Test Loader"""
suite = unittest.TestSuite()
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_addressgeneration.BitmessageTest_AddressGeneration, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_messagesend.BitmessageTest_MessageTesting, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_addsubscription.BitmessageTest_AddSubscription, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_networkstatus.BitmessageTest_NetworkTest, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_blackwhitelist.BitmessageTest_BlackandWhiteList, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_chans.BitmessageTest_ChansTest, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(
test_settingwindow.BitmessageTest_SettingWindowTest, myapp=myapp))
unittest.TextTestRunner().run(suite)

View File

@ -0,0 +1,18 @@
import unittest
class BitmessageTestCase(unittest.TestCase):
"""Unit Test Integration"""
def __init__(self, methodName="runTest", myapp=None):
super(BitmessageTestCase, self).__init__(methodName)
self.myapp = myapp
@staticmethod
def bitmessage_testloader(testcaseclass, myapp=None):
"""Test Loader"""
testnames = unittest.TestLoader().getTestCaseNames(testcaseclass)
suite = unittest.TestSuite()
for name in testnames:
suite.addTest(testcaseclass(name, myapp))
return suite

7
src/gtesting.py Normal file
View File

@ -0,0 +1,7 @@
import state
if __name__ == "__main__":
state.qttesting = True
print(" --------------------------------- Graphical Qt Testing --------------------------------- ")
from bitmessagemain import main
main()

View File

@ -55,3 +55,5 @@ testmode = False
kivy = False
association = ''
qttesting = False