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

Merge branch 'dev'

parents 58d6fa2a 1269e35e
Branches
Tags
No related merge requests found
......@@ -159,7 +159,7 @@ class ConnectionConfigController(QObject):
elif self.mode == ConnectionConfigController.PUBKEY:
self._logger.debug("Pubkey mode")
self.view.button_next.clicked.connect(self.check_pubkey)
if not self.view.label_action.text().endswidth(self.tr(" (Optional)")):
if not self.view.label_action.text().endswith(self.tr(" (Optional)")):
self.view.label_action.setText(self.view.label_action.text() + self.tr(" (Optional)"))
self.view.groupbox_key.hide()
self.view.stacked_pages.setCurrentWidget(self.view.page_connection)
......
......@@ -26,7 +26,7 @@
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>true</bool>
<bool>false</bool>
</attribute>
</widget>
</item>
......
......@@ -10,6 +10,7 @@ import asyncio
class IdentitiesFilterProxyModel(QSortFilterProxyModel):
def __init__(self, app, parent=None):
super().__init__(parent)
self.app = app
self.blockchain_processor = BlockchainProcessor.instanciate(app)
def columnCount(self, parent):
......@@ -57,7 +58,7 @@ class IdentitiesFilterProxyModel(QSortFilterProxyModel):
if source_index.column() in (IdentitiesTableModel.columns_ids.index('renewed'),
IdentitiesTableModel.columns_ids.index('expiration')):
if source_data:
ts = self.blockchain_processor.adjusted_ts(self.connection.currency, source_data)
ts = self.blockchain_processor.adjusted_ts(self.app.currency, source_data)
return QLocale.toString(
QLocale(),
QDateTime.fromTime_t(ts).date(),
......@@ -67,7 +68,7 @@ class IdentitiesFilterProxyModel(QSortFilterProxyModel):
return ""
if source_index.column() == IdentitiesTableModel.columns_ids.index('publication'):
if source_data:
ts = self.blockchain_processor.adjusted_ts(self.connection.currency, source_data)
ts = self.blockchain_processor.adjusted_ts(self.app.currency, source_data)
return QLocale.toString(
QLocale(),
QDateTime.fromTime_t(ts),
......
......@@ -28,6 +28,12 @@ def assert_key_parameters_behaviour(connection_config_dialog, user):
assert connection_config_dialog.view.label_info.text() == user.key.pubkey
def assert_pubkey_parameters_behaviour(connection_config_dialog, user):
QTest.keyClicks(connection_config_dialog.view.edit_uid, user.uid)
QTest.keyClicks(connection_config_dialog.view.edit_pubkey, user.key.pubkey)
assert connection_config_dialog.view.button_next.isEnabled() is True
@pytest.mark.asyncio
async def test_register_empty_blockchain(application, fake_server, bob):
connection_config_dialog = ConnectionConfigController.create_connection(None, application)
......@@ -137,3 +143,30 @@ Yours : {0}, the network : {1}""".format(wrong_bob_pubkey.pubkey, bob.pubkey)
await connection_config_dialog.async_exec()
await simple_fake_server.close()
@pytest.mark.asyncio
async def test_connect_pubkey_wrong_uid(application, simple_fake_server, wrong_bob_uid, bob):
connection_config_dialog = ConnectionConfigController.create_connection(None, application)
def close_dialog():
if connection_config_dialog.view.isVisible():
connection_config_dialog.view.close()
async def exec_test():
QTest.mouseClick(connection_config_dialog.view.button_pubkey, Qt.LeftButton)
await asyncio.sleep(0.6)
QTest.mouseClick(connection_config_dialog.view.button_accept, Qt.LeftButton)
await asyncio.sleep(0.1)
assert connection_config_dialog.view.stacked_pages.currentWidget() == connection_config_dialog.view.page_connection
assert_pubkey_parameters_behaviour(connection_config_dialog, wrong_bob_uid)
QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton)
await asyncio.sleep(0.6)
assert connection_config_dialog.view.label_info.text() == """Your pubkey or UID is different on the network.
Yours : {0}, the network : {1}""".format(wrong_bob_uid.uid, bob.uid)
connection_config_dialog.view.close()
application.loop.call_later(10, close_dialog)
asyncio.ensure_future(exec_test())
await connection_config_dialog.async_exec()
await simple_fake_server.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment