async def exec_test(): QTest.mouseClick(connection_config_dialog.view.button_register, 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_key_parameters_behaviour(connection_config_dialog, bob) QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton) connection_config_dialog.model.connection.password = bob.password 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)) await asyncio.sleep(1) click_on_top_message_box() await asyncio.sleep(1) revocation_file.ensure()
def __attrs_post_init__(self): super().__init__() self._blockchain_processor = BlockchainProcessor.instanciate(self.app) self._sources_processor = SourcesProcessor.instanciate(self.app) self._connections_processor = ConnectionsProcessor.instanciate( self.app) self._contacts_processor = ContactsProcessor.instanciate(self.app)
def send_transfer_again(cls, parent, app, connection, resent_transfer): dialog = QDialog(parent) dialog.setWindowTitle(dialog.tr("Transfer")) dialog.setLayout(QVBoxLayout(dialog)) transfer = cls.create(parent, app) transfer.view.groupbox_connection.show() transfer.view.label_total.show() transfer.view.combo_connections.setCurrentText(connection.title()) transfer.view.edit_pubkey.setText(resent_transfer.receivers[0]) transfer.view.radio_pubkey.setChecked(True) transfer.refresh() current_base = transfer.model.current_base() current_base_amount = resent_transfer.amount / pow(10, resent_transfer.amount_base - current_base) relative = transfer.model.quant_to_rel(current_base_amount / 100) transfer.view.set_spinboxes_parameters(current_base_amount / 100, relative) transfer.view.change_relative_amount(relative) transfer.view.change_quantitative_amount(current_base_amount / 100) connections_processor = ConnectionsProcessor.instanciate(app) wallet_index = connections_processor.connections().index(connection) transfer.view.combo_connections.setCurrentIndex(wallet_index) transfer.view.edit_pubkey.setText(resent_transfer.receivers[0]) transfer.view.radio_pubkey.toggle() transfer.view.edit_message.setText(resent_transfer.comment) dialog.layout().addWidget(transfer.view) transfer.accepted.connect(dialog.accept) transfer.rejected.connect(dialog.reject) return dialog.exec()
async def test_destruction(application_with_one_connection, fake_server_with_blockchain, bob, alice): amount = application_with_one_connection.sources_service.amount( bob.key.pubkey) fake_server_with_blockchain.forge.push( bob.send_money( amount - 80, fake_server_with_blockchain.forge.user_identities[ bob.key.pubkey].sources, alice, fake_server_with_blockchain.forge.blocks[-1].blockUID, "Test receive")) fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() new_blocks = fake_server_with_blockchain.forge.blocks[-3:] connections = ConnectionsProcessor.instanciate( application_with_one_connection).connections() changed_tx, new_tx, new_ud = await application_with_one_connection.transactions_service.handle_new_blocks( connections, new_blocks) await application_with_one_connection.sources_service.refresh_sources( connections, new_tx, new_ud) assert 0 == application_with_one_connection.sources_service.amount( bob.key.pubkey) tx_after_parse = application_with_one_connection.transactions_service.transfers( bob.key.pubkey) assert "Too low balance" in [t.comment for t in tx_after_parse] await fake_server_with_blockchain.close()
async def test_send_more_than_40_sources(application_with_one_connection, fake_server_with_blockchain, bob, alice): start = fake_server_with_blockchain.forge.blocks[-1].number + 1 for i in range(0, 60): fake_server_with_blockchain.forge.generate_dividend() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number connections = ConnectionsProcessor.instanciate( application_with_one_connection).connections() changed_tx, new_tx, new_ud = await application_with_one_connection.transactions_service.handle_new_blocks( connections, start, end) await application_with_one_connection.sources_service.refresh_sources_of_pubkey( bob.key.pubkey) amount_before_send = application_with_one_connection.sources_service.amount( bob.key.pubkey) bob_connection = application_with_one_connection.db.connections_repo.get_one( pubkey=bob.key.pubkey) result, transactions = await application_with_one_connection.documents_service.send_money( bob_connection, bob.salt, bob.password, alice.key.pubkey, amount_before_send, 0, "Test comment") assert transactions[0].comment == "[CHAINED]" assert transactions[1].comment == "Test comment" amount_after_send = application_with_one_connection.sources_service.amount( bob.key.pubkey) assert amount_after_send == 0 await fake_server_with_blockchain.close()
async def test_send_source(application_with_one_connection, fake_server_with_blockchain, bob, alice): amount = application_with_one_connection.sources_service.amount( bob.key.pubkey) fake_server_with_blockchain.forge.push( bob.send_money( 150, fake_server_with_blockchain.forge.user_identities[ bob.key.pubkey].sources, alice, fake_server_with_blockchain.forge.blocks[-1].blockUID, "Test receive")) start = fake_server_with_blockchain.forge.blocks[-1].number + 1 fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number + 1 connections = ConnectionsProcessor.instanciate( application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks( connections, start, end) await application_with_one_connection.sources_service.refresh_sources( connections) assert amount - 150 == application_with_one_connection.sources_service.amount( bob.key.pubkey) await fake_server_with_blockchain.close()
async def test_send_more_than_40_sources(application_with_one_connection, fake_server_with_blockchain, bob, alice): start = fake_server_with_blockchain.forge.blocks[-1].number + 1 for i in range(0, 60): fake_server_with_blockchain.forge.generate_dividend() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() changed_tx, new_tx, new_ud = await application_with_one_connection.transactions_service.handle_new_blocks(connections, start, end) await application_with_one_connection.sources_service.refresh_sources_of_pubkey(bob.key.pubkey) amount_before_send = application_with_one_connection.sources_service.amount(bob.key.pubkey) bob_connection = application_with_one_connection.db.connections_repo.get_one(pubkey=bob.key.pubkey) result, transactions = await application_with_one_connection.documents_service.send_money(bob_connection, bob.salt, bob.password, alice.key.pubkey, amount_before_send, 0, "Test comment") assert transactions[0].comment == "[CHAINED]" assert transactions[1].comment == "Test comment" amount_after_send = application_with_one_connection.sources_service.amount(bob.key.pubkey) assert amount_after_send == 0 await fake_server_with_blockchain.close()
async def test_send_tx_then_validate(application_with_one_connection, fake_server_with_blockchain, bob, alice): tx_before_send = application_with_one_connection.transactions_service.transfers( bob.key.pubkey) bob_connection = application_with_one_connection.db.connections_repo.get_one( pubkey=bob.key.pubkey) await application_with_one_connection.documents_service.send_money( bob_connection, bob.salt, bob.password, alice.key.pubkey, 10, 0, "Test comment") tx_after_send = application_with_one_connection.transactions_service.transfers( bob.key.pubkey) assert len(tx_before_send) + 1 == len(tx_after_send) assert tx_after_send[-1].state is Transaction.AWAITING assert tx_after_send[-1].written_block == 0 start = fake_server_with_blockchain.forge.blocks[-1].number fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number connections = ConnectionsProcessor.instanciate( application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks( connections, start, end) tx_after_parse = application_with_one_connection.transactions_service.transfers( bob.key.pubkey) assert tx_after_parse[-1].state is Transaction.VALIDATED assert tx_after_parse[ -1].written_block == fake_server_with_blockchain.forge.blocks[ -3].number await fake_server_with_blockchain.close()
def send_transfer_again(cls, parent, app, connection, resent_transfer): dialog = cls.create(parent, app) dialog.view.combo_connections.setCurrentText(connection.title()) dialog.view.edit_pubkey.setText(resent_transfer.receiver) dialog.view.radio_pubkey.setChecked(True) dialog.refresh() current_base = dialog.model.current_base() current_base_amount = resent_transfer.amount / pow( 10, resent_transfer.amount_base - current_base) relative = dialog.model.quant_to_rel(current_base_amount / 100) dialog.view.set_spinboxes_parameters(current_base_amount / 100, relative) dialog.view.change_relative_amount(relative) dialog.view.change_quantitative_amount(current_base_amount / 100) connections_processor = ConnectionsProcessor.instanciate(app) wallet_index = connections_processor.connections().index(connection) dialog.view.combo_connections.setCurrentIndex(wallet_index) dialog.view.edit_pubkey.setText(resent_transfer.receiver) dialog.view.radio_pubkey.setChecked(True) dialog.view.edit_message.setText(resent_transfer.comment) return dialog.exec()
def __init__(self, app, connection): super().__init__() self.app = app self.connection = connection self._connections_processor = ConnectionsProcessor.instanciate( self.app) self._identities_processor = IdentitiesProcessor.instanciate(self.app) self._blockchain_processor = BlockchainProcessor.instanciate(self.app)
def __attrs_post_init__(self): super().__init__() self._connections_processor = ConnectionsProcessor.instanciate( self.app) self._certifications_processor = CertificationsProcessor.instanciate( self.app) self._identities_processor = IdentitiesProcessor.instanciate(self.app) self._blockchain_processor = BlockchainProcessor.instanciate(self.app)
async def exec_test(): QTest.mouseClick(connection_config_dialog.view.button_connect, Qt.LeftButton) await asyncio.sleep(1) assert connection_config_dialog.view.stacked_pages.currentWidget() == connection_config_dialog.view.page_connection assert_key_parameters_behaviour(connection_config_dialog, bob) QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton) 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()
async def exec_test(): QTest.mouseClick(connection_config_dialog.view.button_connect, 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_key_parameters_behaviour(connection_config_dialog, bob) QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton) await asyncio.sleep(0.1) assert connection_config_dialog.view.stacked_pages.currentWidget() == connection_config_dialog.view.page_services assert len(ConnectionsProcessor.instanciate(application).connections()) == 1
async def test_receive_source(application_with_one_connection, fake_server_with_blockchain, bob, alice): amount = application_with_one_connection.sources_service.amount(bob.key.pubkey) fake_server_with_blockchain.forge.push(alice.send_money(150, fake_server_with_blockchain.forge.user_identities[alice.key.pubkey].sources, bob, fake_server_with_blockchain.forge.blocks[-1].blockUID, "Test receive")) start = fake_server_with_blockchain.forge.blocks[-1].number + 1 fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number + 1 connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks(connections, start, end) await application_with_one_connection.sources_service.refresh_sources(connections) assert amount + 150 == application_with_one_connection.sources_service.amount(bob.key.pubkey) await fake_server_with_blockchain.close()
async def test_receive_tx(application_with_one_connection, fake_server_with_blockchain, bob, alice): tx_before_send = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) fake_server_with_blockchain.forge.push(alice.send_money(10, fake_server_with_blockchain.forge.user_identities[alice.key.pubkey].sources, bob, fake_server_with_blockchain.forge.blocks[-1].blockUID, "Test receive")) fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() new_blocks = fake_server_with_blockchain.forge.blocks[-3:] connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks(connections, new_blocks) tx_after_parse = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) assert tx_after_parse[-1].state is Transaction.VALIDATED assert len(tx_before_send) + 1 == len(tx_after_parse) await fake_server_with_blockchain.close()
async def test_issue_dividend(application_with_one_connection, fake_server_with_blockchain, bob): dividends_before_send = application_with_one_connection.transactions_service.dividends(bob.key.pubkey) fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.generate_dividend() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.generate_dividend() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() new_blocks = fake_server_with_blockchain.forge.blocks[-5:] connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks(connections, new_blocks) dividends_after_parse = application_with_one_connection.transactions_service.dividends(bob.key.pubkey) assert len(dividends_before_send) + 2 == len(dividends_after_parse) await fake_server_with_blockchain.close()
async def remove_connection(self, connection): connections_processor = ConnectionsProcessor.instanciate(self) connections_processor.remove_connections(connection) CertificationsProcessor.instanciate(self).cleanup_connection(connection, connections_processor.pubkeys()) IdentitiesProcessor.instanciate(self).cleanup_connection(connection) SourcesProcessor.instanciate(self).drop_all_of(currency=connection.currency, pubkey=connection.pubkey) DividendsProcessor.instanciate(self).cleanup_connection(connection) TransactionsProcessor.instanciate(self).cleanup_connection(connection, connections_processor.pubkeys()) self.db.commit() self.connection_removed.emit(connection)
async def test_receive_tx(application_with_one_connection, fake_server_with_blockchain, bob, alice): tx_before_send = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) fake_server_with_blockchain.forge.push(alice.send_money(10, fake_server_with_blockchain.forge.user_identities[alice.key.pubkey].sources, bob, fake_server_with_blockchain.forge.blocks[-1].blockUID, "Test receive")) start = fake_server_with_blockchain.forge.blocks[-1].number fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks(connections, start, end) tx_after_parse = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) assert tx_after_parse[-1].state is Transaction.VALIDATED assert len(tx_before_send) + 1 == len(tx_after_parse) await fake_server_with_blockchain.close()
def __init__(self, parent, app, blockchain_service, identities_service): """ Constructor of a model of WoT component :param sakia.gui.identities.controller.IdentitiesController parent: the controller :param sakia.app.Application app: the app :param sakia.services.BlockchainService blockchain_service: the blockchain service :param sakia.services.IdentitiesService identities_service: the identities service """ super().__init__(parent, app, blockchain_service, identities_service) self.app = app self._connections_processor = ConnectionsProcessor.instanciate(self.app) self.blockchain_service = blockchain_service self.identities_service = identities_service self.wot_graph = WoTGraph(self.app, self.blockchain_service, self.identities_service) self.identity = None
def __init__(self, app, blockchain_service, identities_service, nx_graph): """ Init Graph instance :param sakia.app.Application app: Application instance :param sakia.services.BlockchainService blockchain_service: Blockchain service instance :param sakia.services.IdentitiesService identities_service: Identities service instance :param networkx.Graph nx_graph: The networkx graph :return: """ super().__init__() self.app = app self.identities_service = identities_service self.blockchain_service = blockchain_service self._connections_processor = ConnectionsProcessor.instanciate(app) # graph empty if None parameter self.nx_graph = nx_graph if nx_graph else networkx.DiGraph()
async def test_issue_dividend(application_with_one_connection, fake_server_with_blockchain, bob): dividends_before_send = application_with_one_connection.transactions_service.dividends(bob.key.pubkey) start = fake_server_with_blockchain.forge.blocks[-1].number + 1 fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.generate_dividend() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.generate_dividend() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks(connections, start, end) dividends_after_parse = application_with_one_connection.transactions_service.dividends(bob.key.pubkey) assert len(dividends_before_send) + 2 == len(dividends_after_parse) await fake_server_with_blockchain.close()
async def remove_connection(self, connection): connections_processor = ConnectionsProcessor.instanciate(self) connections_processor.remove_connections(connection) CertificationsProcessor.instanciate(self).cleanup_connection( connection, connections_processor.pubkeys()) IdentitiesProcessor.instanciate(self).cleanup_connection(connection) SourcesProcessor.instanciate(self).drop_all_of( currency=connection.currency, pubkey=connection.pubkey) DividendsProcessor.instanciate(self).cleanup_connection(connection) TransactionsProcessor.instanciate(self).cleanup_connection( connection, connections_processor.pubkeys()) self.db.commit()
async def exec_test(): QTest.mouseClick(connection_config_dialog.view.button_register, 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_key_parameters_behaviour(connection_config_dialog, bob) QTest.mouseClick(connection_config_dialog.view.button_next, Qt.LeftButton) connection_config_dialog.model.connection.password = bob.password await asyncio.sleep(1) select_file_dialog(str(revocation_file)) await asyncio.sleep(1) await asyncio.sleep(1) revocation_file.ensure() assert connection_config_dialog.view.stacked_pages.currentWidget() == connection_config_dialog.view.page_services assert len(ConnectionsProcessor.instanciate(application).connections()) == 1 accept_dialog("Registration")
def __init__(self, parent, app, blockchain_service, identities_service): """ Constructor of a model of WoT component :param sakia.gui.identities.controller.IdentitiesController parent: the controller :param sakia.app.Application app: the app :param sakia.services.BlockchainService blockchain_service: the blockchain service :param sakia.services.IdentitiesService identities_service: the identities service """ super().__init__(parent, app, blockchain_service, identities_service) self.app = app self._connections_processor = ConnectionsProcessor.instanciate( self.app) self.blockchain_service = blockchain_service self.identities_service = identities_service self.wot_graph = WoTGraph(self.app, self.blockchain_service, self.identities_service) self.identity = None
def instanciate_services(self): nodes_processor = NodesProcessor(self.db.nodes_repo) bma_connector = BmaConnector(nodes_processor, self.parameters) connections_processor = ConnectionsProcessor(self.db.connections_repo) identities_processor = IdentitiesProcessor(self.db.identities_repo, self.db.certifications_repo, self.db.blockchains_repo, bma_connector) certs_processor = CertificationsProcessor(self.db.certifications_repo, self.db.identities_repo, bma_connector) blockchain_processor = BlockchainProcessor.instanciate(self) sources_processor = SourcesProcessor.instanciate(self) transactions_processor = TransactionsProcessor.instanciate(self) dividends_processor = DividendsProcessor.instanciate(self) nodes_processor.initialize_root_nodes(self.currency) self.db.commit() self.documents_service = DocumentsService.instanciate(self) self.identities_service = IdentitiesService( self.currency, connections_processor, identities_processor, certs_processor, blockchain_processor, bma_connector) self.transactions_service = TransactionsService( self.currency, transactions_processor, dividends_processor, identities_processor, connections_processor, bma_connector) self.sources_service = SourcesServices( self.currency, sources_processor, connections_processor, transactions_processor, blockchain_processor, bma_connector) self.blockchain_service = BlockchainService(self, self.currency, blockchain_processor, bma_connector, self.identities_service, self.transactions_service, self.sources_service) self.network_service = NetworkService.load(self, self.currency, nodes_processor, self.blockchain_service, self.identities_service)
async def remove_connection(self, connection): await self.stop_current_profile() connections_processor = ConnectionsProcessor.instanciate(self) connections_processor.remove_connections(connection) IdentitiesProcessor.instanciate(self).cleanup_connection(connection) CertificationsProcessor.instanciate(self).cleanup_connection(connection, connections_processor.pubkeys()) SourcesProcessor.instanciate(self).drop_all_of(currency=connection.currency, pubkey=connection.pubkey) DividendsProcessor.instanciate(self).cleanup_connection(connection) TransactionsProcessor.instanciate(self).cleanup_connection(connection, connections_processor.pubkeys()) if not connections_processor.connections(): NodesProcessor.instanciate(self).drop_all(self.currency) self.db.commit() self.start_coroutines()
async def test_send_tx_then_validate(application_with_one_connection, fake_server_with_blockchain, bob, alice): tx_before_send = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) bob_connection = application_with_one_connection.db.connections_repo.get_one(pubkey=bob.key.pubkey) await application_with_one_connection.documents_service.send_money(bob_connection, bob.salt, bob.password, alice.key.pubkey, 10, 0, "Test comment") tx_after_send = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) assert len(tx_before_send) + 1 == len(tx_after_send) assert tx_after_send[-1].state is Transaction.AWAITING assert tx_after_send[-1].written_block == 0 start = fake_server_with_blockchain.forge.blocks[-1].number fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() end = fake_server_with_blockchain.forge.blocks[-1].number connections = ConnectionsProcessor.instanciate(application_with_one_connection).connections() await application_with_one_connection.transactions_service.handle_new_blocks(connections, start, end) tx_after_parse = application_with_one_connection.transactions_service.transfers(bob.key.pubkey) assert tx_after_parse[-1].state is Transaction.VALIDATED assert tx_after_parse[-1].written_block == fake_server_with_blockchain.forge.blocks[-3].number await fake_server_with_blockchain.close()
async def test_receive_source(application_with_one_connection, fake_server_with_blockchain, bob, alice): amount = application_with_one_connection.sources_service.amount( bob.key.pubkey) fake_server_with_blockchain.forge.push( alice.send_money( 150, fake_server_with_blockchain.forge.user_identities[ alice.key.pubkey].sources, bob, fake_server_with_blockchain.forge.blocks[-1].blockUID, "Test receive")) fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() fake_server_with_blockchain.forge.forge_block() new_blocks = fake_server_with_blockchain.forge.blocks[-3:] connections = ConnectionsProcessor.instanciate( application_with_one_connection).connections() changed_tx, new_tx, new_ud = await application_with_one_connection.transactions_service.handle_new_blocks( connections, new_blocks) await application_with_one_connection.sources_service.refresh_sources( connections, new_tx, new_ud) assert amount + 150 == application_with_one_connection.sources_service.amount( bob.key.pubkey) await fake_server_with_blockchain.close()
def insert_or_update_connection(self): ConnectionsProcessor(self.app.db.connections_repo).commit_connection( self.connection)
def key_exists(self): return self.connection.pubkey in ConnectionsProcessor.instanciate( self.app).pubkeys()
def connections(self): return ConnectionsProcessor.instanciate(self.app).connections()
def __attrs_post_init__(self): super().__init__() self._blockchain_processor = BlockchainProcessor.instanciate(self.app) self._sources_processor = SourcesProcessor.instanciate(self.app) self._connections_processor = ConnectionsProcessor.instanciate(self.app) self._contacts_processor = ContactsProcessor.instanciate(self.app)
def connection_exists(self): return len(ConnectionsProcessor.instanciate(self).connections()) > 0
def __attrs_post_init__(self): super().__init__() self._connections_processor = ConnectionsProcessor.instanciate(self.app) self._certifications_processor = CertificationsProcessor.instanciate(self.app) self._identities_processor = IdentitiesProcessor.instanciate(self.app) self._blockchain_processor = BlockchainProcessor.instanciate(self.app)