def test_add_get_drop_node(meta_repo): nodes_repo = NodesRepo(meta_repo.conn) inserted = Node(currency="testcurrency", pubkey="7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ", endpoints="""BASIC_MERKLED_API test-net.duniter.fr 13.222.11.22 9201 BASIC_MERKLED_API testnet.duniter.org 80 UNKNOWNAPI some useless information""", peer_blockstamp=BlockUID.empty(), uid="doe", current_buid="15-76543400E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67", current_ts=12376543345, previous_buid="14-AEFFCB00E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67", state=0, software="duniter", version="0.30.17") nodes_repo.insert(inserted) node = nodes_repo.get_one(currency="testcurrency", pubkey="7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ") assert node.currency == "testcurrency" assert node.pubkey == "7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ" assert node.endpoints[0] == BMAEndpoint("test-net.duniter.fr", "13.222.11.22", None, 9201) assert node.endpoints[1] == BMAEndpoint("testnet.duniter.org", None, None, 80) assert node.endpoints[2] == UnknownEndpoint("UNKNOWNAPI", ["some", "useless", "information"]) assert node.previous_buid == block_uid("14-AEFFCB00E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67") assert node.current_buid == block_uid("15-76543400E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67") assert node.state == 0 assert node.software == "duniter" assert node.version == "0.30.17" assert node.merkle_peers_root == Node.MERKLE_EMPTY_ROOT assert node.merkle_peers_leaves == tuple() nodes_repo.drop(node) node = nodes_repo.get_one(pubkey="7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ") assert node is None
def peer_doc(self): peer = Peer(2, self.forge.currency, self.forge.key.pubkey, BlockUID.empty(), [BMAEndpoint(None, "127.0.0.1", None, self.http.port)], None) peer.sign([self.forge.key]) return peer
async def go(): _, srv, port, url = await self.create_server( 'GET', '/tx/sources/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): async with aiohttp.ClientSession() as session: connection = next( BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await sources(connection, 'pubkey')
async def go(): _, srv, port, url = await self.create_server( 'GET', '/blockchain/with/certs', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): async with aiohttp.ClientSession() as session: connection = next( BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await certifications(connection)
async def go(): _, port, url = await self.create_server('GET', '/network/peering', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): async with aiohttp.ClientSession() as session: connection = next( BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await network.peering(connection)
async def go(): _, srv, port, url = await self.create_server( 'GET', '/blockchain/memberships/8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): async with aiohttp.ClientSession() as session: connection = next( BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await memberships( connection, "8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU")