Skip to content
Snippets Groups Projects
Commit 43a4d59e authored by inso's avatar inso
Browse files

Fix tests

parent 04997234
No related branches found
No related tags found
No related merge requests found
...@@ -50,4 +50,5 @@ async def test_certification_init_community(application_with_one_connection, fak ...@@ -50,4 +50,5 @@ async def test_certification_init_community(application_with_one_connection, fak
application_with_one_connection.loop.call_later(10, close_dialog) application_with_one_connection.loop.call_later(10, close_dialog)
certification_dialog.view.show() certification_dialog.view.show()
await exec_test() await exec_test()
close_dialog()
await fake_server_with_blockchain.close() await fake_server_with_blockchain.close()
...@@ -3,7 +3,7 @@ import pytest ...@@ -3,7 +3,7 @@ import pytest
from PyQt5.QtWidgets import QApplication, QMessageBox from PyQt5.QtWidgets import QApplication, QMessageBox
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest from PyQt5.QtTest import QTest
from sakia.data.processors import ConnectionsProcessor from sakia.data.processors import ConnectionsProcessor, BlockchainProcessor
from sakia.gui.dialogs.connection_cfg import ConnectionConfigController from sakia.gui.dialogs.connection_cfg import ConnectionConfigController
from tests.helpers import click_on_top_message_box, select_file_dialog from tests.helpers import click_on_top_message_box, select_file_dialog
...@@ -39,6 +39,7 @@ async def test_register_empty_blockchain(application, fake_server, bob, tmpdir): ...@@ -39,6 +39,7 @@ async def test_register_empty_blockchain(application, fake_server, bob, tmpdir):
tmpdir.mkdir("test_register") tmpdir.mkdir("test_register")
revocation_file = tmpdir.join("test_register").join("revocation.txt") revocation_file = tmpdir.join("test_register").join("revocation.txt")
identity_file = tmpdir.join("test_register").join("identity.txt") identity_file = tmpdir.join("test_register").join("identity.txt")
await BlockchainProcessor.instanciate(application).initialize_blockchain(application.currency)
connection_config_dialog = ConnectionConfigController.create_connection(None, application) connection_config_dialog = ConnectionConfigController.create_connection(None, application)
def close_dialog(): def close_dialog():
...@@ -56,20 +57,14 @@ async def test_register_empty_blockchain(application, fake_server, bob, tmpdir): ...@@ -56,20 +57,14 @@ async def test_register_empty_blockchain(application, fake_server, bob, tmpdir):
QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton) QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton)
connection_config_dialog.model.connection.password = bob.password connection_config_dialog.model.connection.password = bob.password
await asyncio.sleep(1) await asyncio.sleep(1)
assert connection_config_dialog.view.stacked_pages.currentWidget() == connection_config_dialog.view.page_services
assert len(ConnectionsProcessor.instanciate(application).connections()) == 1
click_on_top_message_box()
await asyncio.sleep(1)
select_file_dialog(str(identity_file))
await asyncio.sleep(1)
click_on_top_message_box()
identity_file.ensure()
await asyncio.sleep(1)
select_file_dialog(str(revocation_file)) select_file_dialog(str(revocation_file))
await asyncio.sleep(1) await asyncio.sleep(1)
click_on_top_message_box() click_on_top_message_box()
await asyncio.sleep(1) await asyncio.sleep(1)
revocation_file.ensure() revocation_file.ensure()
assert connection_config_dialog.view.stacked_pages.currentWidget() == connection_config_dialog.view.page_services
assert len(ConnectionsProcessor.instanciate(application).connections()) == 1
click_on_top_message_box()
application.loop.call_later(10, close_dialog) application.loop.call_later(10, close_dialog)
asyncio.ensure_future(exec_test()) asyncio.ensure_future(exec_test())
...@@ -79,6 +74,7 @@ async def test_register_empty_blockchain(application, fake_server, bob, tmpdir): ...@@ -79,6 +74,7 @@ async def test_register_empty_blockchain(application, fake_server, bob, tmpdir):
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_connect(application, fake_server_with_blockchain, bob): async def test_connect(application, fake_server_with_blockchain, bob):
await BlockchainProcessor.instanciate(application).initialize_blockchain(application.currency)
connection_config_dialog = ConnectionConfigController.create_connection(None, application) connection_config_dialog = ConnectionConfigController.create_connection(None, application)
def close_dialog(): def close_dialog():
......
...@@ -32,4 +32,5 @@ async def test_transfer(application_with_one_connection, fake_server_with_blockc ...@@ -32,4 +32,5 @@ async def test_transfer(application_with_one_connection, fake_server_with_blockc
application_with_one_connection.loop.call_later(10, close_dialog) application_with_one_connection.loop.call_later(10, close_dialog)
transfer_dialog.view.show() transfer_dialog.view.show()
await exec_test() await exec_test()
close_dialog()
await fake_server_with_blockchain.close() await fake_server_with_blockchain.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment