Inbox PopMenu functionality

This commit is contained in:
lakshyacis 2020-03-04 14:58:48 +05:30
parent ea2e11ced8
commit 380de9d1d9
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB
11 changed files with 236 additions and 69 deletions

View File

@ -2514,6 +2514,10 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.textEditMessage.setFocus() self.ui.textEditMessage.setFocus()
def on_action_MarkAllRead(self): def on_action_MarkAllRead(self):
import state
if state.qttesting:
tableWidget = self.getCurrentMessagelist()
else:
if QtGui.QMessageBox.question( if QtGui.QMessageBox.question(
self, "Marking all messages as read?", self, "Marking all messages as read?",
_translate( _translate(
@ -3778,6 +3782,10 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuYourIdentities.addAction(self.actionMarkAllRead) self.popMenuYourIdentities.addAction(self.actionMarkAllRead)
if self.popMenuYourIdentities.isEmpty(): if self.popMenuYourIdentities.isEmpty():
return return
if state.qttesting:
self.popMenuYourIdentities.move(point.x(), point.y())
self.popMenuYourIdentities.show()
else:
self.popMenuYourIdentities.exec_( self.popMenuYourIdentities.exec_(
self.ui.treeWidgetYourIdentities.mapToGlobal(point)) self.ui.treeWidgetYourIdentities.mapToGlobal(point))

View File

@ -14,25 +14,29 @@ class BitmessageTest_AddressGeneration(BitmessageTestCase):
def test_generateaddress(self): def test_generateaddress(self):
"""Method clicks on new label pushbutton and create new address with random label""" """Method clicks on new label pushbutton and create new address with random label"""
try:
address_count = len(BMConfigParser().addresses())
QTest.qWait(500) QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(500) QTest.qWait(500)
try:
random_label = ""
self.myapp.ui.pushButtonNewAddress.setStyleSheet("QPushButton {background-color: #FF5733; color: white;}") self.myapp.ui.pushButtonNewAddress.setStyleSheet("QPushButton {background-color: #FF5733; color: white;}")
QTest.qWait(50) QTest.qWait(50)
self.myapp.ui.pushButtonNewAddress.setStyleSheet("") self.myapp.ui.pushButtonNewAddress.setStyleSheet("")
label_gen_obj = address_dialogs.NewAddressDialog() label_gen_obj = address_dialogs.NewAddressDialog()
QTest.qWait(500) QTest.qWait(1000)
address_count = len(BMConfigParser().addresses())
QTest.qWait(400) random_label = ""
for _ in range(12): for _ in range(12):
random_label = random_label + choice(ascii_lowercase) random_label += choice(ascii_lowercase)
label_gen_obj.newaddresslabel.setText(random_label) label_gen_obj.newaddresslabel.setText(random_label)
QTest.qWait(5) QTest.qWait(2)
QTest.qWait(500)
QTest.qWait(600)
label_gen_obj.accept() label_gen_obj.accept()
QTest.qWait(800) QTest.qWait(800)
self.assertEqual(len(BMConfigParser().addresses()), address_count + 1) self.assertEqual(len(BMConfigParser().addresses()), address_count + 1)
self.assertEqual(str(BMConfigParser().get(BMConfigParser().addresses()[-1], "label")), random_label) self.assertEqual(str(BMConfigParser().get(BMConfigParser().addresses()[-1], "label")), random_label)
print("\n Test Pass :--> Address Generated Successfully \n") print("\n Test Pass :--> Address Generated Successfully \n")
@ -45,36 +49,40 @@ class BitmessageTest_AddressGeneration(BitmessageTestCase):
def test_generateaddresswithpassphrase(self): def test_generateaddresswithpassphrase(self):
"""Clicks on the create new label with passphrase pushbutton and generates 8 address""" """Clicks on the create new label with passphrase pushbutton and generates 8 address"""
try:
address_count = len(BMConfigParser().addresses())
QTest.qWait(500) QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(500) QTest.qWait(500)
try:
random_password1, random_password2 = "", ""
self.myapp.ui.pushButtonNewAddress.setStyleSheet("QPushButton {background-color: #FF5733; color: white;}") self.myapp.ui.pushButtonNewAddress.setStyleSheet("QPushButton {background-color: #FF5733; color: white;}")
QTest.qWait(50) QTest.qWait(50)
self.myapp.ui.pushButtonNewAddress.setStyleSheet("") self.myapp.ui.pushButtonNewAddress.setStyleSheet("")
label_gen_obj = address_dialogs.NewAddressDialog() label_gen_obj = address_dialogs.NewAddressDialog()
QTest.qWait(500) QTest.qWait(500)
address_count = len(BMConfigParser().addresses())
QTest.qWait(400)
label_gen_obj.radioButtonDeterministicAddress.click() label_gen_obj.radioButtonDeterministicAddress.click()
QTest.qWait(400) QTest.qWait(400)
random_password1, random_password2 = "", ""
for i in range(15): for i in range(15):
random_password1 += choice(ascii_lowercase) random_password1 += choice(ascii_lowercase)
label_gen_obj.lineEditPassphrase.setText(random_password1) label_gen_obj.lineEditPassphrase.setText(random_password1)
QTest.qWait(5) QTest.qWait(2)
QTest.qWait(500) QTest.qWait(500)
for i in random_password1: for i in random_password1:
random_password2 += i random_password2 += i
label_gen_obj.lineEditPassphraseAgain.setText(random_password2) label_gen_obj.lineEditPassphraseAgain.setText(random_password2)
QTest.qWait(5) QTest.qWait(2)
QTest.qWait(800)
QTest.qWait(850)
label_gen_obj.accept() label_gen_obj.accept()
self.assertEqual(random_password1, random_password2) self.assertEqual(random_password1, random_password2)
print(" Creating Address ......") print(" Creating Address ......")
QTest.qWait(3000) QTest.qWait(2500)
print(" Please Wait.! Creating 8 Address ......") print(" Please Wait.! Creating 8 Address ......")
QTest.qWait(3000) QTest.qWait(2500)
self.assertEqual(len(BMConfigParser().addresses()), address_count + 8) self.assertEqual(len(BMConfigParser().addresses()), address_count + 8)
QTest.qWait(100) QTest.qWait(100)
print("\n Test Pass :--> Address Generated Successfully with passphrase \n") print("\n Test Pass :--> Address Generated Successfully with passphrase \n")

View File

@ -17,20 +17,23 @@ class BitmessageTest_AddSubscription(BitmessageTestCase):
def test_subscription(self): def test_subscription(self):
"""Test for subscription functionality""" """Test for subscription functionality"""
try:
if BMConfigParser().addresses():
QTest.qWait(500) QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.subscriptions) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.subscriptions)
QTest.qWait(500) QTest.qWait(500)
if BMConfigParser().addresses():
try:
self.dialog = dialogs.NewSubscriptionDialog(self.myapp) self.dialog = dialogs.NewSubscriptionDialog(self.myapp)
self.dialog.show() self.dialog.show()
QTest.qWait(800) QTest.qWait(800)
random_label = "" random_label = ""
for _ in range(30): for _ in range(30):
random_label += choice(ascii_lowercase) random_label += choice(ascii_lowercase)
self.dialog.lineEditLabel.setText(random_label) self.dialog.lineEditLabel.setText(random_label)
QTest.qWait(5) QTest.qWait(5)
QTest.qWait(500) QTest.qWait(500)
rand_address = choice(BMConfigParser().addresses()) rand_address = choice(BMConfigParser().addresses())
random_address = "" random_address = ""
for x in range(len(rand_address)): for x in range(len(rand_address)):
@ -38,7 +41,9 @@ class BitmessageTest_AddSubscription(BitmessageTestCase):
self.dialog.lineEditAddress.setText(random_address) self.dialog.lineEditAddress.setText(random_address)
QTest.qWait(5) QTest.qWait(5)
QTest.qWait(500) QTest.qWait(500)
QtCore.QTimer.singleShot(0, self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked) QtCore.QTimer.singleShot(0, self.dialog.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked)
try: try:
QTest.qWait(800) QTest.qWait(800)
address, label = self.dialog.data address, label = self.dialog.data
@ -46,6 +51,7 @@ class BitmessageTest_AddSubscription(BitmessageTestCase):
QTest.qWait(500) QTest.qWait(500)
print("\n Test Fail :--> Error, While Creating subscription list. \n") print("\n Test Fail :--> Error, While Creating subscription list. \n")
return 0 return 0
if shared.isAddressInMySubscriptionsList(address): if shared.isAddressInMySubscriptionsList(address):
print( print(
"\n Test Fail :--> You cannot add the same address to your subscriptions twice." "\n Test Fail :--> You cannot add the same address to your subscriptions twice."
@ -53,6 +59,7 @@ class BitmessageTest_AddSubscription(BitmessageTestCase):
) )
QTest.qWait(500) QTest.qWait(500)
return 0 return 0
self.myapp.addSubscription(address, label) self.myapp.addSubscription(address, label)
sub_add = sqlQuery("select address from subscriptions where label='" + random_label + "'")[0] sub_add = sqlQuery("select address from subscriptions where label='" + random_label + "'")[0]
self.assertEqual(random_address, sub_add[0]) self.assertEqual(random_address, sub_add[0])
@ -60,13 +67,13 @@ class BitmessageTest_AddSubscription(BitmessageTestCase):
QTest.qWait(100) QTest.qWait(100)
self.assertTrue(True, " \n Test Pass :--> Subscription Done Successfully!") self.assertTrue(True, " \n Test Pass :--> Subscription Done Successfully!")
return 1 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: else:
QTest.qWait(100) QTest.qWait(100)
print("\n Test Fail :--> No Address Found! \n") print("\n Test Fail :--> No Address Found! \n")
self.assertTrue(False, " \n Test Fail :--> No Address Found!") self.assertTrue(False, " \n Test Fail :--> No Address Found!")
return 0 return 0
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

View File

@ -20,24 +20,28 @@ class BitmessageTest_BlackandWhiteList(BitmessageTestCase):
def test_blackwhitelist(self): def test_blackwhitelist(self):
"""Tab switch to blacklist and add the address on blacklist and whitelist""" """Tab switch to blacklist and add the address on blacklist and whitelist"""
try:
QTest.qWait(500) QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.blackwhitelist) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.blackwhitelist)
QTest.qWait(500) QTest.qWait(500)
try:
self.blacklist_obj = blacklist.Blacklist() self.blacklist_obj = blacklist.Blacklist()
self.dialog = AddAddressDialog(self.myapp) self.dialog = AddAddressDialog(self.myapp)
blacklistcount = len(sqlQuery("Select * from blacklist")) blacklistcount = len(sqlQuery("Select * from blacklist"))
self.myapp.ui.blackwhitelist.radioButtonBlacklist.click() self.myapp.ui.blackwhitelist.radioButtonBlacklist.click()
self.checkblacklist(self.myapp) self.checkblacklist(self.myapp)
QTest.qWait(500) QTest.qWait(500)
self.assertEqual(blacklistcount + 1, len(sqlQuery("Select * from blacklist"))) self.assertEqual(blacklistcount + 1, len(sqlQuery("Select * from blacklist")))
whitelistcount = len(sqlQuery("Select * from whitelist")) whitelistcount = len(sqlQuery("Select * from whitelist"))
self.myapp.ui.blackwhitelist.radioButtonWhitelist.click() self.myapp.ui.blackwhitelist.radioButtonWhitelist.click()
self.checkblacklist(self.myapp) self.checkblacklist(self.myapp)
QTest.qWait(500) QTest.qWait(500)
self.assertEqual(whitelistcount + 1, len(sqlQuery("Select * from whitelist"))) self.assertEqual(whitelistcount + 1, len(sqlQuery("Select * from whitelist")))
self.assertTrue(True, " \n Test Pass :--> Black/WhiteList Functionality Tested Successfully!")
except: except:
pass self.assertTrue(False, " \n Test Fail :--> Black/WhiteList Functionality Failed!.")
def checkblacklist(self, myapp): def checkblacklist(self, myapp):
"""fill blacklist and whitelist fields""" """fill blacklist and whitelist fields"""

View File

@ -11,7 +11,5 @@ class BitmessageTest_ChansTest(BitmessageTestCase):
"""Switch to chans window and test""" """Switch to chans window and test"""
QTest.qWait(1200) QTest.qWait(1200)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.chans) 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") print("\n Test Pass :--> Chans Test Passed! \n")
return 1 return 1

View File

@ -0,0 +1,134 @@
"""Inbox TabWidget QTreeWidget Testing"""
import random
from random import choice
from string import ascii_lowercase
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import Qt
from PyQt4.QtTest import QTest
from bitmessageqt import dialogs
from bmconfigparser import BMConfigParser
from testloader import BitmessageTestCase
class BitmessageTest_Inbox_PopMenu(BitmessageTestCase):
"""Inbox TabWidget QTreeWidget popMenu Fucntionality testing"""
def test_sider(self):
"""Show QTreeWidget popmenu"""
QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(500)
treeWidget = self.myapp.ui.treeWidgetYourIdentities
self.levelitem = treeWidget.topLevelItem(random.randint(1, len(BMConfigParser().addresses())))
self.myapp.ui.treeWidgetYourIdentities.setCurrentItem(self.levelitem)
rect = self.myapp.ui.treeWidgetYourIdentities.visualItemRect(self.levelitem)
self.currentItem = self.myapp.getCurrentItem()
self.myapp.on_context_menuYourIdentities(QtCore.QPoint(rect.x() + 200, rect.y() + 200))
QTest.qWait(500)
self.myapp.popMenuYourIdentities.hide()
QTest.qWait(100)
self.copy_clipboard()
QTest.qWait(100)
self.enable_disable()
QTest.qWait(100)
self.special_address_behavior()
QTest.qWait(100)
self.email_gateway()
QTest.qWait(100)
self.mark_all_as_read()
def copy_clipboard(self):
"""Copy address to clipboard and test"""
try:
text_selected = self.levelitem.text(0)
QTest.qWait(250)
self.myapp.popMenuYourIdentities.actions()[2].trigger()
QTest.qWait(750)
if str(QtGui.QApplication.clipboard().text()) in str(text_selected):
self.assertTrue(True, " Test Pass :--> Copy functionality working fine \n")
print(" Test Pass :--> Copy functionality working fine \n")
else:
print(" Test Fail :--> Copy functionality failed \n")
self.assertTrue(False, " Test Fail :--> Copy functionality failed \n")
except:
print(" Test Fail :--> Copy functionality failed \n")
self.assertTrue(False, " Test Fail :--> Copy functionality failed \n")
def enable_disable(self):
"""Enable address and disable address"""
QTest.qWait(500)
try:
if self.currentItem.isEnabled:
QTest.qWait(300)
self.myapp.popMenuYourIdentities.actions()[4].trigger()
print("Address is Disabled \n")
QTest.qWait(1000)
self.myapp.on_action_Enable()
print("Address is Enabled \n")
QTest.qWait(1000)
else:
QTest.qWait(300)
self.myapp.popMenuYourIdentities.actions()[4].trigger()
print("Address is Enabled \n")
QTest.qWait(1000)
self.myapp.on_action_Disable()
print("Address is Disabled \n")
QTest.qWait(1000)
except:
self.assertTrue(False, " Test Fail :--> Enable Disable failed \n")
def special_address_behavior(self):
"""Tests for special address"""
try:
special_add = dialogs.SpecialAddressBehaviorDialog(self.myapp, BMConfigParser())
special_add.lineEditMailingListName.setText("")
QTest.qWait(1000)
special_add.radioButtonBehaviorMailingList.click()
QTest.qWait(500)
special_add.lineEditMailingListName.setText("".join(choice(ascii_lowercase) for x in range(15)))
QTest.qWait(1000)
QTest.mouseClick(special_add.buttonBox.button(QtGui.QDialogButtonBox.Ok), Qt.LeftButton)
self.assertTrue(True, " Test Pass :--> Special Address Behavior Functionality Passed \n")
print(" Test Pass :--> Special Address Behavior Functionality Passed \n")
except:
print(" Test Fail :--> Special Address Behavior Functionality failed \n")
self.assertTrue(False, " Test Fail :--> Special Address Behavior Functionality failed \n")
def email_gateway(self):
"""Test email gateway functionality"""
try:
QTest.qWait(200)
email_gateway = dialogs.EmailGatewayDialog(self.myapp, config=BMConfigParser())
QTest.qWait(300)
email_gateway.show()
QTest.qWait(1000)
email_gateway.radioButtonRegister.click()
QTest.qWait(500)
email = (
("".join(choice(ascii_lowercase) for x in range(10)))
+ "@"
+ ("".join(choice(ascii_lowercase) for x in range(7)))
+ ".com"
)
email_gateway.lineEditEmail.setText(email)
QTest.qWait(1000)
QTest.mouseClick(email_gateway.buttonBox.button(QtGui.QDialogButtonBox.Ok), Qt.LeftButton)
self.assertTrue(True, " Test Pass :--> Email-Gateway Functionality Passed \n")
print(" Test Pass :--> Email-Gateway Functionality Passed \n")
except:
print(" Test Fail :--> Email-Gateway Functionality failed \n")
self.assertTrue(False, " Test Fail :--> Email-Gateway Functionality failed \n")
def mark_all_as_read(self):
"""Mark all messages as read"""
try:
QTest.qWait(1000)
self.myapp.popMenuYourIdentities.actions()[11].trigger()
QTest.qWait(200)
self.assertTrue(True, " Test Pass :--> Mark All as Read Functionality Passed \n")
print(" Test Pass :--> Mark All as Read Functionality Passed \n")
except:
print(" Test Fail :--> Mark All as Read Functionality failed \n")
self.assertTrue(False, " Test Fail :--> Mark All as Read Functionality failed \n")

View File

@ -20,11 +20,13 @@ class BitmessageTest_MessageTesting(BitmessageTestCase):
if BMConfigParser().addresses(): if BMConfigParser().addresses():
QTest.qWait(500) QTest.qWait(500)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.send) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.send)
QTest.qWait(800) QTest.qWait(500)
self.myapp.ui.comboBoxSendFrom.setCurrentIndex( self.myapp.ui.comboBoxSendFrom.setCurrentIndex(
random.randrange(1, len(BMConfigParser().addresses()) + 1) random.randrange(1, len(BMConfigParser().addresses()) + 1)
) )
QTest.qWait(1000) QTest.qWait(1000)
rand_address = choice(BMConfigParser().addresses()) rand_address = choice(BMConfigParser().addresses())
random_address = "" random_address = ""
for x in range(len(rand_address)): for x in range(len(rand_address)):
@ -32,27 +34,33 @@ class BitmessageTest_MessageTesting(BitmessageTestCase):
self.myapp.ui.lineEditTo.setText(random_address) self.myapp.ui.lineEditTo.setText(random_address)
QTest.qWait(1) QTest.qWait(1)
QTest.qWait(800) QTest.qWait(800)
random_subject = "" random_subject = ""
for x in range(40): for x in range(40):
random_subject += choice(ascii_lowercase) random_subject += choice(ascii_lowercase)
self.myapp.ui.lineEditSubject.setText(random_subject) self.myapp.ui.lineEditSubject.setText(random_subject)
QTest.qWait(1) QTest.qWait(1)
QTest.qWait(800) QTest.qWait(800)
random_message = "" random_message = ""
for x in range(200): for x in range(200):
random_message += choice(ascii_lowercase) random_message += choice(ascii_lowercase)
self.myapp.ui.textEditMessage.setText(random_message) self.myapp.ui.textEditMessage.setText(random_message)
QTest.qWait(1) QTest.qWait(1)
QTest.qWait(800) QTest.qWait(800)
inbox_length = len(sqlQuery("Select msgid from inbox")) inbox_length = len(sqlQuery("Select msgid from inbox"))
QTest.mouseClick(self.myapp.ui.pushButtonSend, Qt.LeftButton) QTest.mouseClick(self.myapp.ui.pushButtonSend, Qt.LeftButton)
QTest.qWait(600) QTest.qWait(600)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
print(" .......................... waiting for message .......................... ") print(" .......................... waiting for message .......................... ")
for x in range(5): for x in range(5):
QTest.qWait(5000) QTest.qWait(5000)
print(" waiting " + x * ".") print(" waiting " + x * ".")
self.assertEqual(sqlQuery("Select toaddress,subject from inbox")[-1], (rand_address, random_subject)) self.assertEqual(sqlQuery("Select toaddress,subject from inbox")[-1], (rand_address, random_subject))
if len(sqlQuery("Select msgid from inbox")) == inbox_length + 1: if len(sqlQuery("Select msgid from inbox")) == inbox_length + 1:
QTest.qWait(100) QTest.qWait(100)
print("\n Test Pass :--> Message Received Successfully \n") print("\n Test Pass :--> Message Received Successfully \n")

View File

@ -9,8 +9,11 @@ class BitmessageTest_NetworkTest(BitmessageTestCase):
def test_network(self): def test_network(self):
"""Switch to network window""" """Switch to network window"""
try:
QTest.qWait(1000) QTest.qWait(1000)
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.networkstatus) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.networkstatus)
QTest.qWait(1200) QTest.qWait(1200)
print("\n Test Pass :--> Network Functionality Working Well! \n") print("\n Test Pass :--> Network Functionality Working Well! \n")
return 1 return 1
except:
print("\n Test Fail :--> Network Functionality Failed! \n")

View File

@ -17,7 +17,7 @@ class BitmessageTest_SettingWindowTest(BitmessageTestCase):
def test_settingwindow(self): def test_settingwindow(self):
"""Triggers the setting window""" """Triggers the setting window"""
self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox) self.myapp.ui.tabWidget.setCurrentWidget(self.myapp.ui.inbox)
QTest.qWait(1700) QTest.qWait(1500)
dialog = dialogs.SettingsDialog(self.myapp, firstrun=self.myapp._firstrun) dialog = dialogs.SettingsDialog(self.myapp, firstrun=self.myapp._firstrun)
self.language_change(dialog) self.language_change(dialog)
QTest.qWait(300) QTest.qWait(300)

View File

@ -7,30 +7,27 @@ import test_blackwhitelist
import test_chans import test_chans
import test_messagesend import test_messagesend
import test_networkstatus import test_networkstatus
import test_settingwindow
import test_quit import test_quit
import test_settingwindow
import test_inbox_popmenu
from testloader import BitmessageTestCase from testloader import BitmessageTestCase
def test_initialize(myapp): def test_initialize(myapp):
"""Test Loader""" """Inititalizing the test cases"""
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest( suite.addTest(
BitmessageTestCase.bitmessage_testloader(test_addressgeneration.BitmessageTest_AddressGeneration, myapp=myapp) BitmessageTestCase.bitmessage_testloader(test_addressgeneration.BitmessageTest_AddressGeneration, myapp=myapp))
)
suite.addTest( suite.addTest(
BitmessageTestCase.bitmessage_testloader(test_messagesend.BitmessageTest_MessageTesting, myapp=myapp) BitmessageTestCase.bitmessage_testloader(test_messagesend.BitmessageTest_MessageTesting, myapp=myapp))
)
suite.addTest( suite.addTest(
BitmessageTestCase.bitmessage_testloader(test_addsubscription.BitmessageTest_AddSubscription, myapp=myapp) 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_networkstatus.BitmessageTest_NetworkTest, myapp=myapp))
suite.addTest( suite.addTest(
BitmessageTestCase.bitmessage_testloader(test_blackwhitelist.BitmessageTest_BlackandWhiteList, myapp=myapp) 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_chans.BitmessageTest_ChansTest, myapp=myapp))
suite.addTest( suite.addTest(
BitmessageTestCase.bitmessage_testloader(test_settingwindow.BitmessageTest_SettingWindowTest, myapp=myapp) BitmessageTestCase.bitmessage_testloader(test_settingwindow.BitmessageTest_SettingWindowTest, myapp=myapp))
) suite.addTest(BitmessageTestCase.bitmessage_testloader(test_inbox_popmenu.BitmessageTest_Inbox_PopMenu, myapp=myapp))
suite.addTest(BitmessageTestCase.bitmessage_testloader(test_quit.BitmessageTest_QuitTest, myapp=myapp)) suite.addTest(BitmessageTestCase.bitmessage_testloader(test_quit.BitmessageTest_QuitTest, myapp=myapp))
unittest.TextTestRunner().run(suite) unittest.TextTestRunner().run(suite)

View File

@ -11,7 +11,7 @@ class BitmessageTestCase(unittest.TestCase):
@staticmethod @staticmethod
def bitmessage_testloader(testcaseclass, myapp=None): def bitmessage_testloader(testcaseclass, myapp=None):
"""Test Loader""" """Method responsible for loading test"""
testnames = unittest.TestLoader().getTestCaseNames(testcaseclass) testnames = unittest.TestLoader().getTestCaseNames(testcaseclass)
suite = unittest.TestSuite() suite = unittest.TestSuite()
for name in testnames: for name in testnames: