diff --git a/tests/api/bma/test_blockchain.py b/tests/api/bma/test_blockchain.py index feda7d8626e0a85df84dcc77377802bab234b3bc..e21778dfc442d1400be0677d9c07c7f1576e9013 100644 --- a/tests/api/bma/test_blockchain.py +++ b/tests/api/bma/test_blockchain.py @@ -43,7 +43,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/parameters', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await parameters(connection) @@ -112,7 +112,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/block/100', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await block(connection, 100) @@ -126,7 +126,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/current', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await current(connection) @@ -187,7 +187,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/hardship/8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await hardship(connection, "8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU") @@ -227,7 +227,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/memberships/8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await memberships(connection, "8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU") @@ -249,7 +249,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/newcomers', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await newcomers(connection) @@ -271,7 +271,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/certs', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await certifications(connection) @@ -293,7 +293,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/joiners', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await joiners(connection) @@ -315,7 +315,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/actives', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await actives(connection) @@ -337,7 +337,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/leavers', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await leavers(connection) @@ -460,7 +460,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/ud', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await ud(connection) @@ -482,7 +482,7 @@ class Test_BMA_blockchain(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/blockchain/with/tx', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await tx(connection) diff --git a/tests/api/bma/test_network.py b/tests/api/bma/test_network.py index 145b5690cc0b5307f673f30761af0fe24b615372..63eeba95c7cf74f7223a4dfa67e5ba293057466c 100644 --- a/tests/api/bma/test_network.py +++ b/tests/api/bma/test_network.py @@ -32,7 +32,7 @@ class TestBMANetwork(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/network/peering', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await network.peering(connection) @@ -72,7 +72,7 @@ class TestBMANetwork(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/network/peering/peers', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await network.peers(connection) diff --git a/tests/api/bma/test_tx.py b/tests/api/bma/test_tx.py index fd89afb586eaaf5dbc0c75eec959b412162dcd2e..1551bae339b5a1809f1f59e785e8e22f4911b904 100644 --- a/tests/api/bma/test_tx.py +++ b/tests/api/bma/test_tx.py @@ -128,7 +128,7 @@ class Test_BMA_TX(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/tx/history/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await history(connection, 'pubkey') @@ -142,7 +142,7 @@ class Test_BMA_TX(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/tx/history/pubkey/blocks/0/100', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await blocks(connection, 'pubkey', 0, 100) @@ -181,7 +181,7 @@ class Test_BMA_TX(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/tx/sources/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await sources(connection, 'pubkey') diff --git a/tests/api/bma/test_wot.py b/tests/api/bma/test_wot.py index 0c4b01f65952878ba81a966ef8ccc3c76c4b390a..61801bf4170e61fb3e47996bc8ffcbc0c92c3743 100644 --- a/tests/api/bma/test_wot.py +++ b/tests/api/bma/test_wot.py @@ -80,7 +80,7 @@ class Test_BMA_Wot(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/wot/lookup/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await lookup(connection, 'pubkey') @@ -104,7 +104,7 @@ class Test_BMA_Wot(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/wot/members', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await members(connection) @@ -158,7 +158,7 @@ class Test_BMA_Wot(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/wot/certifiers-of/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await certifiers_of(connection, 'pubkey') @@ -190,7 +190,7 @@ class Test_BMA_Wot(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/wot/certifiers-of/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await certifiers_of(connection, 'pubkey') @@ -204,7 +204,7 @@ class Test_BMA_Wot(WebFunctionalSetupMixin, unittest.TestCase): async def go(): _, srv, port, url = await self.create_server('GET', '/wot/certified-by/pubkey', handler) with self.assertRaises(jsonschema.exceptions.ValidationError): - with aiohttp.ClientSession() as session: + async with aiohttp.ClientSession() as session: connection = next(BMAEndpoint("127.0.0.1", None, None, port).conn_handler(session)) await certified_by(connection, 'pubkey') diff --git a/tests/api/webserver.py b/tests/api/webserver.py index d01b2fed201a32b4021829aa8657a4a000d71147..82cd47fc62337797d72377a69c9bb7d70ddd82a4 100644 --- a/tests/api/webserver.py +++ b/tests/api/webserver.py @@ -15,7 +15,7 @@ class WebFunctionalSetupMixin: def tearDown(self): if self.handler: - self.loop.run_until_complete(self.handler.finish_connections()) + self.loop.run_until_complete(self.handler.shutdown()) try: self.loop.stop() self.loop.close() @@ -29,8 +29,8 @@ class WebFunctionalSetupMixin: s.close() return port - async def create_server(self, method, path, handler=None, ssl_ctx=None): - app = web.Application(loop=self.loop) + async def create_server(self, method, path, handler=None, ssl_ctx=None): + app = web.Application() if handler: app.router.add_route(method, path, handler) diff --git a/tests/documents/test_crc_pubkey.py b/tests/documents/test_crc_pubkey.py index 1d65292e86a639d39f0d6ac75b91bc3cae06f266..bac3f3e65158f638ee8f0aeca112ec46a0e92895 100644 --- a/tests/documents/test_crc_pubkey.py +++ b/tests/documents/test_crc_pubkey.py @@ -5,4 +5,4 @@ from duniterpy.documents.crc_pubkey import CRCPubkey class Test_CRCPubkey(unittest.TestCase): def test_from_pubkey(self): crc_pubkey = CRCPubkey.from_pubkey("J4c8CARmP9vAFNGtHRuzx14zvxojyRWHW2darguVqjtX") - self.assertEquals(crc_pubkey.crc, "KAv") + self.assertEqual(crc_pubkey.crc, "KAv")