Skip to content
Snippets Groups Projects
Commit 55fa2e53 authored by inso's avatar inso
Browse files

Fix tests

parent 5283014b
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,12 @@ class CertificationDialog(QObject): ...@@ -42,6 +42,12 @@ class CertificationDialog(QObject):
self.password_asker = password_asker self.password_asker = password_asker
self.community = self.account.communities[0] self.community = self.account.communities[0]
self.ui.radio_contact.toggled.connect(lambda c, radio="contact": self.recipient_mode_changed(radio))
self.ui.radio_pubkey.toggled.connect(lambda c, radio="pubkey": self.recipient_mode_changed(radio))
self.ui.radio_search.toggled.connect(lambda c, radio="search": self.recipient_mode_changed(radio))
self.ui.button_box.accepted.connect(self.accept)
self.ui.button_box.rejected.connect(self.widget.reject)
for community in self.account.communities: for community in self.account.communities:
self.ui.combo_community.addItem(community.currency) self.ui.combo_community.addItem(community.currency)
...@@ -52,11 +58,6 @@ class CertificationDialog(QObject): ...@@ -52,11 +58,6 @@ class CertificationDialog(QObject):
self.ui.radio_pubkey.setChecked(True) self.ui.radio_pubkey.setChecked(True)
self.ui.radio_contact.setEnabled(False) self.ui.radio_contact.setEnabled(False)
self.ui.radio_contact.toggled.connect(lambda c, radio="contact": self.recipient_mode_changed(radio))
self.ui.radio_pubkey.toggled.connect(lambda c, radio="pubkey": self.recipient_mode_changed(radio))
self.ui.radio_search.toggled.connect(lambda c, radio="search": self.recipient_mode_changed(radio))
self.ui.button_box.accepted.connect(self.accept)
self.ui.button_box.rejected.connect(self.widget.reject)
self.ui.search_user.button_reset.hide() self.ui.search_user.button_reset.hide()
self.ui.search_user.init(self.app) self.ui.search_user.init(self.app)
self.ui.search_user.change_account(self.account) self.ui.search_user.change_account(self.account)
...@@ -107,7 +108,7 @@ class CertificationDialog(QObject): ...@@ -107,7 +108,7 @@ class CertificationDialog(QObject):
toast.display(self.tr("Certification"), toast.display(self.tr("Certification"),
self.tr("Success sending certification")) self.tr("Success sending certification"))
else: else:
await QAsyncMessageBox.information(self, self.tr("Certification"), await QAsyncMessageBox.information(self.widget, self.tr("Certification"),
self.tr("Success sending certification")) self.tr("Success sending certification"))
QApplication.restoreOverrideCursor() QApplication.restoreOverrideCursor()
self.widget.accept() self.widget.accept()
...@@ -116,7 +117,7 @@ class CertificationDialog(QObject): ...@@ -116,7 +117,7 @@ class CertificationDialog(QObject):
toast.display(self.tr("Certification"), self.tr("Could not broadcast certification : {0}" toast.display(self.tr("Certification"), self.tr("Could not broadcast certification : {0}"
.format(result[1]))) .format(result[1])))
else: else:
await QAsyncMessageBox.critical(self, self.tr("Certification"), await QAsyncMessageBox.critical(self.widget, self.tr("Certification"),
self.tr("Could not broadcast certification : {0}" self.tr("Could not broadcast certification : {0}"
.format(result[1]))) .format(result[1])))
QApplication.restoreOverrideCursor() QApplication.restoreOverrideCursor()
...@@ -172,7 +173,7 @@ class CertificationDialog(QObject): ...@@ -172,7 +173,7 @@ class CertificationDialog(QObject):
def async_exec(self): def async_exec(self):
future = asyncio.Future() future = asyncio.Future()
self.finished.connect(lambda r: future.set_result(r)) self.widget.finished.connect(lambda r: future.set_result(r))
self.widget.open() self.widget.open()
self.refresh() self.refresh()
return future return future
......
...@@ -147,7 +147,7 @@ class TransferMoneyDialog(QObject): ...@@ -147,7 +147,7 @@ class TransferMoneyDialog(QObject):
toast.display(self.tr("Transfer"), toast.display(self.tr("Transfer"),
self.tr("Success sending money to {0}").format(recipient)) self.tr("Success sending money to {0}").format(recipient))
else: else:
await QAsyncMessageBox.information(self, self.tr("Transfer"), await QAsyncMessageBox.information(self.widget, self.tr("Transfer"),
self.tr("Success sending money to {0}").format(recipient)) self.tr("Success sending money to {0}").format(recipient))
QApplication.restoreOverrideCursor() QApplication.restoreOverrideCursor()
...@@ -160,7 +160,7 @@ class TransferMoneyDialog(QObject): ...@@ -160,7 +160,7 @@ class TransferMoneyDialog(QObject):
if self.app.preferences['notifications']: if self.app.preferences['notifications']:
toast.display(self.tr("Transfer"), "Error : {0}".format(result[1])) toast.display(self.tr("Transfer"), "Error : {0}".format(result[1]))
else: else:
await QAsyncMessageBox.critical(self, self.tr("Transfer"), result[1]) await QAsyncMessageBox.critical(self.widget, self.tr("Transfer"), result[1])
QApplication.restoreOverrideCursor() QApplication.restoreOverrideCursor()
self.ui.button_box.setEnabled(True) self.ui.button_box.setEnabled(True)
...@@ -218,8 +218,8 @@ class TransferMoneyDialog(QObject): ...@@ -218,8 +218,8 @@ class TransferMoneyDialog(QObject):
def async_exec(self): def async_exec(self):
future = asyncio.Future() future = asyncio.Future()
self.finished.connect(lambda r: future.set_result(r)) self.widget.finished.connect(lambda r: future.set_result(r))
self.open() self.widget.open()
return future return future
def exec(self): def exec(self):
......
...@@ -74,9 +74,9 @@ class TestCertificationDialog(unittest.TestCase, QuamashTest): ...@@ -74,9 +74,9 @@ class TestCertificationDialog(unittest.TestCase, QuamashTest):
async def exec_test(): async def exec_test():
await asyncio.sleep(1) await asyncio.sleep(1)
QTest.mouseClick(certification_dialog.radio_pubkey, Qt.LeftButton) QTest.mouseClick(certification_dialog.ui.radio_pubkey, Qt.LeftButton)
QTest.keyClicks(certification_dialog.edit_pubkey, "FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn") QTest.keyClicks(certification_dialog.ui.edit_pubkey, "FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn")
QTest.mouseClick(certification_dialog.button_box.button(QDialogButtonBox.Ok), Qt.LeftButton) QTest.mouseClick(certification_dialog.ui.button_box.button(QDialogButtonBox.Ok), Qt.LeftButton)
await asyncio.sleep(1) await asyncio.sleep(1)
topWidgets = QApplication.topLevelWidgets() topWidgets = QApplication.topLevelWidgets()
for w in topWidgets: for w in topWidgets:
......
...@@ -80,10 +80,10 @@ class TestTransferDialog(unittest.TestCase, QuamashTest): ...@@ -80,10 +80,10 @@ class TestTransferDialog(unittest.TestCase, QuamashTest):
async def exec_test(): async def exec_test():
await asyncio.sleep(1) await asyncio.sleep(1)
self.account.wallets[0].caches[self.community.currency].available_sources = await self.wallet.sources(self.community) self.account.wallets[0].caches[self.community.currency].available_sources = await self.wallet.sources(self.community)
QTest.mouseClick(transfer_dialog.radio_pubkey, Qt.LeftButton) QTest.mouseClick(transfer_dialog.ui.radio_pubkey, Qt.LeftButton)
QTest.keyClicks(transfer_dialog.edit_pubkey, "FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn") QTest.keyClicks(transfer_dialog.ui.edit_pubkey, "FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn")
transfer_dialog.spinbox_amount.setValue(10) transfer_dialog.ui.spinbox_amount.setValue(10)
QTest.mouseClick(transfer_dialog.button_box.button(QDialogButtonBox.Ok), Qt.LeftButton) QTest.mouseClick(transfer_dialog.ui.button_box.button(QDialogButtonBox.Ok), Qt.LeftButton)
await asyncio.sleep(1) await asyncio.sleep(1)
topWidgets = QApplication.topLevelWidgets() topWidgets = QApplication.topLevelWidgets()
for w in topWidgets: for w in topWidgets:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment