|
4 | 4 | AioHTTPTestCase, |
5 | 5 | unittest_run_loop, |
6 | 6 | ) |
7 | | -from minos.api_gateway.common import ( |
8 | | - MinosConfig, |
9 | | -) |
10 | | -from minos.api_gateway.discovery import ( |
11 | | - DiscoveryService, |
12 | | -) |
13 | | -from tests.test_api_gateway.test_discovery.dataset import generate_record, generate_random_microservice_names, \ |
14 | | - generate_record_old |
15 | | -from tests.utils import ( |
16 | | - BASE_PATH, |
| 7 | +from minos.api_gateway.common import MinosConfig |
| 8 | +from minos.api_gateway.discovery import DiscoveryService |
| 9 | +from tests.test_api_gateway.test_discovery.dataset import ( |
| 10 | + generate_record, |
| 11 | + generate_random_microservice_names, |
| 12 | + generate_record_old, |
17 | 13 | ) |
| 14 | +from tests.utils import BASE_PATH |
18 | 15 |
|
19 | 16 |
|
20 | 17 | class TestMicroserviceEndpoints(AioHTTPTestCase): |
@@ -70,15 +67,16 @@ async def test_bulk_update(self): |
70 | 67 | # Check updated records are correct |
71 | 68 | for record in expected: |
72 | 69 | response = await self.client.get( |
73 | | - f"/microservices?verb={record['body']['endpoints'][0][0]}&path={record['body']['endpoints'][0][1]}") |
| 70 | + f"/microservices?verb={record['body']['endpoints'][0][0]}&path={record['body']['endpoints'][0][1]}" |
| 71 | + ) |
74 | 72 |
|
75 | 73 | self.assertEqual(200, response.status) |
76 | 74 |
|
77 | 75 | body = await response.json() |
78 | 76 |
|
79 | | - self.assertEqual(record['body']['address'], body["address"]) |
80 | | - self.assertEqual(record['body']['port'], int(body["port"])) |
81 | | - self.assertEqual(record['name'], body["name"]) |
| 77 | + self.assertEqual(record["body"]["address"], body["address"]) |
| 78 | + self.assertEqual(record["body"]["port"], int(body["port"])) |
| 79 | + self.assertEqual(record["name"], body["name"]) |
82 | 80 |
|
83 | 81 | async def test_bulk_update_2(self): |
84 | 82 | expected = list() |
@@ -106,15 +104,16 @@ async def test_bulk_update_2(self): |
106 | 104 |
|
107 | 105 | for record in expected: |
108 | 106 | response = await self.client.get( |
109 | | - f"/microservices?verb={record['body']['endpoints'][0][0]}&path={record['body']['endpoints'][0][1]}") |
| 107 | + f"/microservices?verb={record['body']['endpoints'][0][0]}&path={record['body']['endpoints'][0][1]}" |
| 108 | + ) |
110 | 109 |
|
111 | 110 | self.assertEqual(200, response.status) |
112 | 111 |
|
113 | 112 | body = await response.json() |
114 | 113 |
|
115 | | - self.assertEqual(record['body']['address'], body["address"]) |
116 | | - self.assertEqual(int(record['body']['port']), int(body["port"])) |
117 | | - self.assertEqual(record['name'], body["name"]) |
| 114 | + self.assertEqual(record["body"]["address"], body["address"]) |
| 115 | + self.assertEqual(int(record["body"]["port"]), int(body["port"])) |
| 116 | + self.assertEqual(record["name"], body["name"]) |
118 | 117 |
|
119 | 118 | @unittest_run_loop |
120 | 119 | async def test_post_missing_param(self): |
|
0 commit comments